From 6f65b012c79bb39782a2fded7ceb959c216191b0 Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Mon, 22 Jul 2024 16:30:24 +0000 Subject: [PATCH 1/3] removing smb --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 49429c0..353fdbe 100755 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,8 +17,7 @@ "app_name": "platform-deployment", "app_type": "sdk-service", "addl_debug_shim_suffixes": "client", - "debug_shim_post_yaml_file": "/workspace/platform-deployment/.vscode/debugShim-svcAcct-clusterAdmin.yaml", - "smb_enabled_in_cluster": "true" + "debug_shim_post_yaml_file": "/workspace/platform-deployment/.vscode/debugShim-svcAcct-clusterAdmin.yaml" } }, "customizations": { From 0933270c07d278108ba468e207bfaf6e62016fb7 Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Mon, 22 Jul 2024 16:46:31 +0000 Subject: [PATCH 2/3] updating integration tests to ensure a running pod --- test/integrationTests/TestSharedContext.cs | 2 +- test/integrationTests/Tests/DeploymentTest.cs | 34 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/test/integrationTests/TestSharedContext.cs b/test/integrationTests/TestSharedContext.cs index 2a76c5b..0dfd6b0 100644 --- a/test/integrationTests/TestSharedContext.cs +++ b/test/integrationTests/TestSharedContext.cs @@ -14,7 +14,7 @@ public class TestSharedContext : IDisposable { internal static k8s.Kubernetes K8S_CLIENT = null!; internal static Core.Client SPACEFX_CLIENT = null!; internal static bool HOST_SVC_ONLINE = false; - internal static TimeSpan MAX_TIMESPAN_TO_WAIT_FOR_MSG = TimeSpan.FromSeconds(90); + internal static TimeSpan MAX_TIMESPAN_TO_WAIT_FOR_MSG = TimeSpan.FromSeconds(300); /// /// Setup the SpaceFx Core to be shared across tests diff --git a/test/integrationTests/Tests/DeploymentTest.cs b/test/integrationTests/Tests/DeploymentTest.cs index 2ca3f4c..f46ae0a 100644 --- a/test/integrationTests/Tests/DeploymentTest.cs +++ b/test/integrationTests/Tests/DeploymentTest.cs @@ -13,7 +13,7 @@ public DeploymentTests(TestSharedContext context) { [Fact] public async Task DeployAnApp() { const string testName = nameof(DeployAnApp); - bool podFound = false; + k8s.Models.V1Pod? integrationPod = null; DateTime maxTimeToWait = DateTime.Now.Add(TestSharedContext.MAX_TIMESPAN_TO_WAIT_FOR_MSG); MessageFormats.HostServices.Link.LinkResponse? jsonFileResponse = null; MessageFormats.HostServices.Link.LinkResponse? yamlFileResponse = null; @@ -27,8 +27,8 @@ public async Task DeployAnApp() { var result = await TestSharedContext.K8S_CLIENT.CoreV1.ListPodForAllNamespacesWithHttpMessagesAsync(allowWatchBookmarks: false, watch: false, pretty: true); podList = result.Body as k8s.Models.V1PodList ?? throw new Exception("Failed to get Pod List"); - podFound = podList.Items.Any(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); - Assert.False(podFound); + integrationPod = podList.Items.FirstOrDefault(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); + Assert.Null(integrationPod); Console.WriteLine("Integration Test Pod not found. Continuing with test"); @@ -131,16 +131,20 @@ void LinkResponseEventHandler(object? _, MessageFormats.HostServices.Link.LinkRe DateTime maxTimeToWaitForDeployment = DateTime.Now.Add(TestSharedContext.MAX_TIMESPAN_TO_WAIT_FOR_MSG); Console.WriteLine("Starting polling to wait for deployment..."); - while (!podFound && DateTime.Now <= maxTimeToWaitForDeployment) { + while (integrationPod == null && DateTime.Now <= maxTimeToWaitForDeployment) { result = await TestSharedContext.K8S_CLIENT.CoreV1.ListPodForAllNamespacesWithHttpMessagesAsync(allowWatchBookmarks: false, watch: false, pretty: true); podList = result.Body as k8s.Models.V1PodList ?? throw new Exception("Failed to get Pod List"); - podFound = podList.Items.Any(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); - Console.WriteLine($"...pod found: {podFound}"); - if (!podFound) await Task.Delay(5000); + integrationPod = podList.Items.FirstOrDefault(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); + Console.WriteLine($"...pod found: {integrationPod == null}"); + if ((integrationPod == null) || (integrationPod.Status.Phase == "Pending")) { + integrationPod = null; // Removing the pod since it's not done provisioning yet + await Task.Delay(5000); + } } - if (podFound == false) throw new TimeoutException($"Failed to find deployment after {TestSharedContext.MAX_TIMESPAN_TO_WAIT_FOR_MSG}. Please check that {TestSharedContext.TARGET_SVC_APP_ID} is deployed"); - Assert.True(podFound); + if (integrationPod == null || integrationPod?.Status.Phase == "Pending") throw new TimeoutException($"Failed to find deployment after {TestSharedContext.MAX_TIMESPAN_TO_WAIT_FOR_MSG}. Please check that {TestSharedContext.TARGET_SVC_APP_ID} is deployed"); + Assert.NotNull(integrationPod); + Assert.Equal("Running", integrationPod.Status.Phase); string recdFile = Path.Combine((await TestSharedContext.SPACEFX_CLIENT.GetXFerDirectories()).inbox_directory, "astronaut.jpg"); @@ -158,20 +162,20 @@ void LinkResponseEventHandler(object? _, MessageFormats.HostServices.Link.LinkRe Console.WriteLine("Integration Test Pod Found. Waiting for deletion (max 3 mins)"); maxTimeToWaitForDeployment = DateTime.Now.Add(TimeSpan.FromMinutes(3)); - while (podFound && DateTime.Now <= maxTimeToWaitForDeployment) { + while (integrationPod != null && DateTime.Now <= maxTimeToWaitForDeployment) { result = await TestSharedContext.K8S_CLIENT.CoreV1.ListPodForAllNamespacesWithHttpMessagesAsync(allowWatchBookmarks: false, watch: false, pretty: true); podList = result.Body as k8s.Models.V1PodList ?? throw new Exception("Failed to get Pod List"); - podFound = podList.Items.Any(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); - Console.WriteLine($"...pod found: {podFound}"); - if (podFound) await Task.Delay(5000); + integrationPod = podList.Items.FirstOrDefault(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); + Console.WriteLine($"...pod found: {integrationPod != null}"); + if (integrationPod != null) await Task.Delay(5000); } - if (podFound == true) throw new TimeoutException($"Failed to remove deployment after {TimeSpan.FromMinutes(3)}. Please check that {TestSharedContext.TARGET_SVC_APP_ID} is deployed"); + if (integrationPod != null) throw new TimeoutException($"Failed to remove deployment after {TimeSpan.FromMinutes(3)}. Please check that {TestSharedContext.TARGET_SVC_APP_ID} is deployed"); Console.WriteLine("Integration Test Pod successfully removed."); - Assert.False(podFound); + Assert.Null(integrationPod); } } From c816f6551da307f1cbc502ee1b90cf37768a8dab Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Mon, 22 Jul 2024 16:50:00 +0000 Subject: [PATCH 3/3] updating pod check query --- test/integrationTests/Tests/DeploymentTest.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/integrationTests/Tests/DeploymentTest.cs b/test/integrationTests/Tests/DeploymentTest.cs index f46ae0a..ccc4bfa 100644 --- a/test/integrationTests/Tests/DeploymentTest.cs +++ b/test/integrationTests/Tests/DeploymentTest.cs @@ -134,12 +134,10 @@ void LinkResponseEventHandler(object? _, MessageFormats.HostServices.Link.LinkRe while (integrationPod == null && DateTime.Now <= maxTimeToWaitForDeployment) { result = await TestSharedContext.K8S_CLIENT.CoreV1.ListPodForAllNamespacesWithHttpMessagesAsync(allowWatchBookmarks: false, watch: false, pretty: true); podList = result.Body as k8s.Models.V1PodList ?? throw new Exception("Failed to get Pod List"); - integrationPod = podList.Items.FirstOrDefault(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase)); + integrationPod = podList.Items.FirstOrDefault(pod => pod.Name().Contains("integration-test", StringComparison.CurrentCultureIgnoreCase) && pod.Status.Phase == "Running"); Console.WriteLine($"...pod found: {integrationPod == null}"); - if ((integrationPod == null) || (integrationPod.Status.Phase == "Pending")) { - integrationPod = null; // Removing the pod since it's not done provisioning yet + if (integrationPod == null) await Task.Delay(5000); - } } if (integrationPod == null || integrationPod?.Status.Phase == "Pending") throw new TimeoutException($"Failed to find deployment after {TestSharedContext.MAX_TIMESPAN_TO_WAIT_FOR_MSG}. Please check that {TestSharedContext.TARGET_SVC_APP_ID} is deployed");