From 00b6d03d9d343d933d1ba9fac16b40711dcbad74 Mon Sep 17 00:00:00 2001 From: Cavaughn Browne <113555337+cxbrowne1207@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:56:26 -0500 Subject: [PATCH] update api upgrade test to specifically use appropropriate templates for version (#6656) --- test/e2e/cloudstack_test.go | 21 ++++++++------------- test/e2e/docker_test.go | 3 ++- test/e2e/upgrade_from_latest.go | 25 ++++++++++++++++--------- test/e2e/vsphere_test.go | 8 ++------ test/framework/clustervalidator.go | 7 ++++--- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/e2e/cloudstack_test.go b/test/e2e/cloudstack_test.go index 3864b55d67a0..c4e88c3436b5 100644 --- a/test/e2e/cloudstack_test.go +++ b/test/e2e/cloudstack_test.go @@ -4107,10 +4107,7 @@ func TestCloudStackKubernetesRedHat123To124UpgradeFromLatestMinorReleaseAPI(t *t ) managementCluster.GenerateClusterConfigForVersion(release.Version, framework.ExecuteWithEksaRelease(release)) managementCluster.UpdateClusterConfig( - api.ClusterToConfigFiller( - api.WithKubernetesVersion(v1alpha1.Kube123), - ), - cloudstack.WithRedhat123(), + cloudstack.WithKubeVersionAndOS(v1alpha1.Kube123, framework.RedHat8, release), ) test := framework.NewMulticlusterE2ETest(t, managementCluster) wc := framework.NewClusterE2ETest( @@ -4123,14 +4120,15 @@ func TestCloudStackKubernetesRedHat123To124UpgradeFromLatestMinorReleaseAPI(t *t api.ClusterToConfigFiller( api.WithManagementCluster(managementCluster.ClusterName), ), - cloudstack.WithRedhat123(), + cloudstack.WithKubeVersionAndOS(v1alpha1.Kube123, framework.RedHat8, release), ) test.WithWorkloadClusters(wc) runMulticlusterUpgradeFromReleaseFlowAPI( test, release, - cloudstack.WithRedhat124(), + v1alpha1.Kube124, + framework.RedHat8, ) } @@ -4147,11 +4145,7 @@ func TestCloudStackKubernetesRedHat123to124UpgradeFromLatestMinorReleaseGitHubFl ) managementCluster.GenerateClusterConfigForVersion(release.Version, framework.ExecuteWithEksaRelease(release)) managementCluster.UpdateClusterConfig( - api.ClusterToConfigFiller( - api.WithKubernetesVersion(v1alpha1.Kube123), - ), - - cloudstack.WithRedhat123(), + cloudstack.WithKubeVersionAndOS(v1alpha1.Kube123, framework.RedHat8, release), framework.WithFluxGithubConfig(), ) test := framework.NewMulticlusterE2ETest(t, managementCluster) @@ -4168,7 +4162,7 @@ func TestCloudStackKubernetesRedHat123to124UpgradeFromLatestMinorReleaseGitHubFl api.ClusterToConfigFiller( api.WithManagementCluster(managementCluster.ClusterName), ), - cloudstack.WithRedhat123(), + cloudstack.WithKubeVersionAndOS(v1alpha1.Kube123, framework.RedHat8, release), framework.WithFluxGithubConfig(), ) test.WithWorkloadClusters(wc) @@ -4176,7 +4170,8 @@ func TestCloudStackKubernetesRedHat123to124UpgradeFromLatestMinorReleaseGitHubFl runMulticlusterUpgradeFromReleaseFlowAPIWithFlux( test, release, - cloudstack.WithRedhat124(), + v1alpha1.Kube124, + framework.RedHat8, ) } diff --git a/test/e2e/docker_test.go b/test/e2e/docker_test.go index 3adc49835ede..883005b52c71 100644 --- a/test/e2e/docker_test.go +++ b/test/e2e/docker_test.go @@ -1027,7 +1027,8 @@ func TestDockerKubernetes123to124UpgradeFromLatestMinorReleaseAPI(t *testing.T) runMulticlusterUpgradeFromReleaseFlowAPI( test, release, - api.ClusterToConfigFiller(api.WithKubernetesVersion(v1alpha1.Kube124)), + v1alpha1.Kube124, + "", ) } diff --git a/test/e2e/upgrade_from_latest.go b/test/e2e/upgrade_from_latest.go index b89bd3e39974..d4daad4f23b8 100644 --- a/test/e2e/upgrade_from_latest.go +++ b/test/e2e/upgrade_from_latest.go @@ -58,7 +58,8 @@ func runUpgradeWithFluxFromReleaseFlow(test *framework.ClusterE2ETest, latestRel test.DeleteCluster() } -func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETest, release *releasev1.EksARelease, upgradeChanges api.ClusterConfigFiller) { +func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETest, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion, os framework.OS) { + provider := test.ManagementCluster.Provider test.CreateManagementCluster(framework.ExecuteWithEksaRelease(release)) test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { @@ -69,7 +70,9 @@ func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETes oldCluster := test.ManagementCluster.GetEKSACluster() - test.ManagementCluster.UpdateClusterConfig(upgradeChanges) + test.ManagementCluster.UpdateClusterConfig( + provider.WithKubeVersionAndOS(kubeVersion, os, nil), + ) test.ManagementCluster.UpgradeCluster() test.ManagementCluster.ValidateCluster(test.ManagementCluster.ClusterConfig.Cluster.Spec.KubernetesVersion) test.ManagementCluster.StopIfFailed() @@ -79,7 +82,7 @@ func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETes // Upgrade bundle workload clusters now because they still have the old versions of the bundle. test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { wc.UpdateClusterConfig( - api.JoinClusterConfigFillers(upgradeChanges), + provider.WithKubeVersionAndOS(kubeVersion, os, nil), api.ClusterToConfigFiller( api.WithEksaVersion(cluster.Spec.EksaVersion), ), @@ -95,6 +98,7 @@ func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETes // Create workload cluster with old bundle test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { wc.UpdateClusterConfig( + provider.WithKubeVersionAndOS(kubeVersion, os, release), api.ClusterToConfigFiller( api.WithEksaVersion(oldCluster.Spec.EksaVersion), ), @@ -111,7 +115,8 @@ func runMulticlusterUpgradeFromReleaseFlowAPI(test *framework.MulticlusterE2ETes test.DeleteManagementCluster() } -func runMulticlusterUpgradeFromReleaseFlowAPIWithFlux(test *framework.MulticlusterE2ETest, release *releasev1.EksARelease, upgradeChanges api.ClusterConfigFiller) { +func runMulticlusterUpgradeFromReleaseFlowAPIWithFlux(test *framework.MulticlusterE2ETest, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion, os framework.OS) { + provider := test.ManagementCluster.Provider test.CreateManagementCluster(framework.ExecuteWithEksaRelease(release)) test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { @@ -122,17 +127,19 @@ func runMulticlusterUpgradeFromReleaseFlowAPIWithFlux(test *framework.Multiclust oldCluster := test.ManagementCluster.GetEKSACluster() - test.ManagementCluster.UpdateClusterConfig(upgradeChanges) + test.ManagementCluster.UpdateClusterConfig( + provider.WithKubeVersionAndOS(kubeVersion, os, nil), + ) test.ManagementCluster.UpgradeCluster() test.ManagementCluster.ValidateCluster(test.ManagementCluster.ClusterConfig.Cluster.Spec.KubernetesVersion) test.ManagementCluster.StopIfFailed() cluster := test.ManagementCluster.GetEKSACluster() - // Upgrade bundle workload clusters now because they still have the old versions of the bundle. + // Upgrade bundle workload clusters now using the new EksaVersion test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { test.PushWorkloadClusterToGit(wc, - api.JoinClusterConfigFillers(upgradeChanges), + provider.WithKubeVersionAndOS(kubeVersion, os, nil), api.ClusterToConfigFiller( api.WithEksaVersion(cluster.Spec.EksaVersion), ), @@ -143,12 +150,12 @@ func runMulticlusterUpgradeFromReleaseFlowAPIWithFlux(test *framework.Multiclust wc.ValidateClusterDelete() }) - // Create workload cluster with old bundle + // Create workload cluster with the old EksaVersion test.RunConcurrentlyInWorkloadClusters(func(wc *framework.WorkloadCluster) { test.PushWorkloadClusterToGit(wc, + provider.WithKubeVersionAndOS(kubeVersion, os, release), api.ClusterToConfigFiller( api.WithEksaVersion(oldCluster.Spec.EksaVersion), - api.WithEksaVersion(nil), ), ) wc.WaitForKubeconfig() diff --git a/test/e2e/vsphere_test.go b/test/e2e/vsphere_test.go index e9e05c77dedf..b743cf2e6ca6 100644 --- a/test/e2e/vsphere_test.go +++ b/test/e2e/vsphere_test.go @@ -2715,12 +2715,8 @@ func TestVSphereKubernetes123to124UpgradeFromLatestMinorReleaseBottleRocketAPI(t runMulticlusterUpgradeFromReleaseFlowAPI( test, release, - api.JoinClusterConfigFillers( - provider.WithBottleRocket124(), - api.VSphereToConfigFiller( - provider.Bottlerocket124Template(), // Set the template so it doesn't get autoimported - ), - ), + v1alpha1.Kube124, + framework.Bottlerocket1, ) } diff --git a/test/framework/clustervalidator.go b/test/framework/clustervalidator.go index c97b32466d23..3d80740178f6 100644 --- a/test/framework/clustervalidator.go +++ b/test/framework/clustervalidator.go @@ -18,14 +18,15 @@ import ( ) func validationsForExpectedObjects() []clusterf.StateValidation { - mediumRetier := retrier.NewWithMaxRetries(120, 5*time.Second) - longRetier := retrier.NewWithMaxRetries(120, 10*time.Second) + mediumRetier := retrier.New(10 * time.Minute) + longRetier := retrier.New(30 * time.Minute) return []clusterf.StateValidation{ - clusterf.RetriableStateValidation(mediumRetier, validations.ValidateClusterReady), clusterf.RetriableStateValidation(mediumRetier, validations.ValidateEKSAObjects), clusterf.RetriableStateValidation(longRetier, validations.ValidateControlPlaneNodes), clusterf.RetriableStateValidation(longRetier, validations.ValidateWorkerNodes), clusterf.RetriableStateValidation(mediumRetier, validations.ValidateCilium), + // This should be checked last as the Cluster should only be ready after all the other validations pass. + clusterf.RetriableStateValidation(mediumRetier, validations.ValidateClusterReady), } }