Skip to content

Commit

Permalink
#375: neon-desktop testing pass (in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflill committed Jul 17, 2023
1 parent b83ba9d commit 420ac8b
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 98 deletions.
4 changes: 2 additions & 2 deletions Lib/Neon.Kube.Aws/AwsHostingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4295,8 +4295,8 @@ public override async Task<ClusterHealth> GetClusterHealthAsync(TimeSpan timeout
{
// There are no deployed VMs: looks like the cluster isn't running.

clusterHealth.State = ClusterState.Off;
clusterHealth.Summary = "Cluster is offline.";
clusterHealth.State = ClusterState.NotFound;
clusterHealth.Summary = "Cluster not found.";

return clusterHealth;
}
Expand Down
2 changes: 1 addition & 1 deletion Lib/Neon.Kube.Azure/AzureHostingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3293,7 +3293,7 @@ public override async Task<ClusterHealth> GetClusterHealthAsync(TimeSpan timeout
// There are no deployed VMs: looks like the cluster isn't running.

clusterHealth.State = ClusterState.NotFound;
clusterHealth.Summary = "Cluster is offline";
clusterHealth.Summary = "Cluster not found.";

return clusterHealth;
}
Expand Down
8 changes: 8 additions & 0 deletions Lib/Neon.Kube.HyperV/HyperVHostingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,14 @@ public override async Task<ClusterHealth> GetClusterHealthAsync(TimeSpan timeout
// short-circuit the health check when the cluster nodes are not provisioned,
// are paused or appear to be transitioning between states.

if (clusterHealth.Nodes.Values.Count == 0)
{
clusterHealth.State = ClusterState.NotFound;
clusterHealth.Summary = "Cluster not found.";

return clusterHealth;
}

var commonNodeState = clusterHealth.Nodes.Values.First();

foreach (var nodeState in clusterHealth.Nodes.Values)
Expand Down
8 changes: 8 additions & 0 deletions Lib/Neon.Kube.XenServer/XenServerHostingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,14 @@ public override async Task<ClusterHealth> GetClusterHealthAsync(TimeSpan timeout
// short-circuit the health check when the cluster nodes are not provisioned,
// are paused or appear to be transitioning between states.

if (clusterHealth.Nodes.Values.Count == 0)
{
clusterHealth.State = ClusterState.NotFound;
clusterHealth.Summary = "Cluster not found.";

return clusterHealth;
}

var commonNodeState = clusterHealth.Nodes.Values.First();

foreach (var nodeState in clusterHealth.Nodes.Values)
Expand Down
2 changes: 1 addition & 1 deletion Lib/Neon.Kube.Xunit/ClusterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ public TestFixtureStatus StartWithClusterDefinition(ClusterDefinition clusterDef

using (var cluster = ClusterProxy.Create(new KubeSetupState() { ClusterDefinition = clusterDefinition }, new HostingManagerFactory(), cloudMarketplace: options.CloudMarketplace))
{
cluster.DeleteClusterAsync(clusterDefinition).WaitWithoutAggregate();
cluster.DeleteClusterAsync().WaitWithoutAggregate();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

using YamlDotNet.Serialization;

using Neon.Common;
Expand Down
14 changes: 11 additions & 3 deletions Lib/Neon.Kube/Hosting/IHostingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,19 @@ public interface IHostingManager : IDisposable
Task<HostingResourceAvailability> GetResourceAvailabilityAsync(long reserveMemory = 0, long reserveDisk = 0);

/// <summary>
/// Retrieves the health status of a cluster from the hosting manager's perspective. This includes information
/// about the infrastructor provisioned for the cluster.
/// Retrieves the health status of the current cluster from the hosting manager's perspective
/// This includes information about the infrastructure provisioned for the cluster.
/// </summary>
/// <param name="timeout">Optionally specifies the maximum time to wait for the result. This defaults to <b>15 seconds</b>.</param>
/// <returns>The <see cref="ClusterHealth"/>.</returns>
/// <returns>
/// <para>
/// The <see cref="ClusterHealth"/> information for the current cluster.
/// </para>
/// <note>
/// When there is no current cluster, the health information will return indicating
/// that no cluster was found.
/// </note>
/// </returns>
Task<ClusterHealth> GetClusterHealthAsync(TimeSpan timeout = default);

/// <summary>
Expand Down
180 changes: 90 additions & 90 deletions Lib/Neon.Kube/Kubernetes/KubernetesExtensions.NamespacedCustom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ public static partial class KubernetesExtensions
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The deserialized object list.</returns>
public static async Task<V1CustomObjectList<T>> ListNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
string namespaceParameter,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string namespaceParameter,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down Expand Up @@ -246,18 +246,18 @@ public static async Task<V1CustomObjectList<T>> ListNamespacedCustomObjectAsync<
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The deserialized object list.</returns>
public static async Task<HttpOperationResponse<object>> ListNamespacedCustomObjectWithHttpMessagesAsync<T>(
this ICustomObjectsOperations k8s,
string namespaceParameter,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string namespaceParameter,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject
{
Expand Down Expand Up @@ -373,21 +373,21 @@ public static async Task<HttpOperationResponse<object>> ListNamespacedCustomObje
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The deserialized object list.</returns>
public static async Task<V1CustomObjectList<KubernetesObjectMetadata>> ListNamespacedCustomObjectMetadataAsync<T>(
this ICustomObjectsOperations k8s,
string namespaceParameter,
string group,
string version,
string plural,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string namespaceParameter,
string group,
string version,
string plural,
bool? allowWatchBookmarks = null,
string continueParameter = null,
string fieldSelector = null,
string labelSelector = null,
int? limit = null,
string resourceVersion = null,
string resourceVersionMatch = null,
int? timeoutSeconds = null,
bool? watch = null,
CancellationToken cancellationToken = default)
{
await SyncContext.Clear;
Covenant.Requires<ArgumentNullException>(!string.IsNullOrEmpty(namespaceParameter), nameof(namespaceParameter));
Expand Down Expand Up @@ -437,13 +437,13 @@ public static async Task<V1CustomObjectList<KubernetesObjectMetadata>> ListNames
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The new object.</returns>
public static async Task<T> CreateNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down Expand Up @@ -479,10 +479,10 @@ public static async Task<T> CreateNamespacedCustomObjectAsync<T>(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The deserialized object.</returns>
public static async Task<T> ReadNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
string name,
string namespaceParameter,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string name,
string namespaceParameter,
CancellationToken cancellationToken = default)

where T : IKubernetesObject, new()
{
Expand Down Expand Up @@ -524,13 +524,13 @@ public static async Task<T> ReadNamespacedCustomObjectAsync<T>(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The updated object.</returns>
public static async Task<T> ReplaceNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject, new()
{
Expand Down Expand Up @@ -577,13 +577,13 @@ public static async Task<T> ReplaceNamespacedCustomObjectAsync<T>(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The updated object.</returns>
public static async Task<T> UpsertNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
T body,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down Expand Up @@ -663,14 +663,14 @@ await k8s.ReadNamespacedCustomObjectAsync<T>(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The updated custom object.</returns>
public static async Task<T> PatchNamespacedCustomObjectStatusAsync<T>(
this ICustomObjectsOperations k8s,
V1Patch patch,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
bool? force = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
V1Patch patch,
string name,
string namespaceParameter,
string dryRun = null,
string fieldManager = null,
bool? force = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down Expand Up @@ -731,15 +731,15 @@ public static async Task<T> PatchNamespacedCustomObjectStatusAsync<T>(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The tracking <see cref="Task"/>.</returns>
public static async Task DeleteNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
string name,
string namespaceParameter,
V1DeleteOptions body = null,
int? gracePeriodSeconds = null,
bool? orphanDependents = null,
string propagationPolicy = null,
string dryRun = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string name,
string namespaceParameter,
V1DeleteOptions body = null,
int? gracePeriodSeconds = null,
bool? orphanDependents = null,
string propagationPolicy = null,
string dryRun = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down Expand Up @@ -813,15 +813,15 @@ await k8s.DeleteNamespacedCustomObjectAsync(
/// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
/// <returns>The tracking <see cref="Task"/>.</returns>
public static async Task DeleteNamespacedCustomObjectAsync<T>(
this ICustomObjectsOperations k8s,
string namespaceParameter,
T @object,
V1DeleteOptions body = null,
int? gracePeriodSeconds = null,
bool? orphanDependents = null,
string propagationPolicy = null,
string dryRun = null,
CancellationToken cancellationToken = default)
this ICustomObjectsOperations k8s,
string namespaceParameter,
T @object,
V1DeleteOptions body = null,
int? gracePeriodSeconds = null,
bool? orphanDependents = null,
string propagationPolicy = null,
string dryRun = null,
CancellationToken cancellationToken = default)

where T : IKubernetesObject<V1ObjectMeta>, new()
{
Expand Down
2 changes: 1 addition & 1 deletion Lib/Neon.Kube/Proxy/ClusterProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public enum Operation
/// <summary>
/// <para>
/// Only cluster lifecycle operations like <see cref="StartAsync()"/>, <see cref="StopAsync(StopMode)"/>,
/// and <see cref="ClusterProxy.DeleteClusterAsync(ClusterDefinition)"/> will be enabled.
/// and <see cref="ClusterProxy.DeleteClusterAsync()"/> will be enabled.
/// </para>
/// <note>
/// These life cycle methods do not required a URI or file reference to a node image.
Expand Down

0 comments on commit 420ac8b

Please sign in to comment.