Skip to content

Commit

Permalink
update api upgrade test to specifically use appropropriate templates …
Browse files Browse the repository at this point in the history
…for version (#6656)
  • Loading branch information
cxbrowne1207 authored Sep 7, 2023
1 parent edc1df1 commit 00b6d03
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
21 changes: 8 additions & 13 deletions test/e2e/cloudstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
)
}

Expand All @@ -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)
Expand All @@ -4168,15 +4162,16 @@ func TestCloudStackKubernetesRedHat123to124UpgradeFromLatestMinorReleaseGitHubFl
api.ClusterToConfigFiller(
api.WithManagementCluster(managementCluster.ClusterName),
),
cloudstack.WithRedhat123(),
cloudstack.WithKubeVersionAndOS(v1alpha1.Kube123, framework.RedHat8, release),
framework.WithFluxGithubConfig(),
)
test.WithWorkloadClusters(wc)

runMulticlusterUpgradeFromReleaseFlowAPIWithFlux(
test,
release,
cloudstack.WithRedhat124(),
v1alpha1.Kube124,
framework.RedHat8,
)
}

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ func TestDockerKubernetes123to124UpgradeFromLatestMinorReleaseAPI(t *testing.T)
runMulticlusterUpgradeFromReleaseFlowAPI(
test,
release,
api.ClusterToConfigFiller(api.WithKubernetesVersion(v1alpha1.Kube124)),
v1alpha1.Kube124,
"",
)
}

Expand Down
25 changes: 16 additions & 9 deletions test/e2e/upgrade_from_latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()
Expand All @@ -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),
),
Expand All @@ -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),
),
Expand All @@ -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) {
Expand All @@ -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),
),
Expand All @@ -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()
Expand Down
8 changes: 2 additions & 6 deletions test/e2e/vsphere_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}

Expand Down
7 changes: 4 additions & 3 deletions test/framework/clustervalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down

0 comments on commit 00b6d03

Please sign in to comment.