Skip to content

Commit

Permalink
Combine multiple upgrades for tinkerbell tests into single test (#8102)
Browse files Browse the repository at this point in the history
* Combine multiple upgrades for tinkerbell tests into single test

Signed-off-by: Rahul Ganesh <[email protected]>

* Generate cluster config for test

Signed-off-by: Rahul Ganesh <[email protected]>

* Add the test to hardware count file and skip single version upgrade tests

Signed-off-by: Rahul Ganesh <[email protected]>

---------

Signed-off-by: Rahul Ganesh <[email protected]>
Co-authored-by: Rahul Ganesh <[email protected]>
  • Loading branch information
rahulbabu95 and Rahul Ganesh authored May 3, 2024
1 parent 5f6ce7e commit 058237c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/e2e/SKIPPED_TESTS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ skipped_tests:
- TestTinkerbellKubernetes125UbuntuWorkerNodeScaleUpWithAPI
- TestTinkerbellKubernetes125UbuntuAddWorkerNodeGroupWithAPI
- TestTinkerbellSingleNode125ManagementScaleupWorkloadWithAPI
#Skip single K8s version upgrade tests as the same is covered by multiple K8s version upgrade from 1.25 to 1.29 to save on hardware resources and running time
- TestTinkerbellKubernetes125UbuntuTo126Upgrade
- TestTinkerbellKubernetes126UbuntuTo127Upgrade
- TestTinkerbellKubernetes127UbuntuTo128Upgrade
- TestTinkerbellKubernetes128UbuntuTo129Upgrade
# Tinkerbell Packages
# Skip test cases for packages other than hello-eks-anywhere and not for K 1.28.
- TestTinkerbellKubernetes126UbuntuSingleNodeCuratedPackagesEmissaryFlow
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/TINKERBELL_HARDWARE_COUNT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ TestTinkerbellKubernetes125UbuntuTo126SingleNodeInPlaceUpgrade: 1
TestTinkerbellKubernetes126UbuntuTo127SingleNodeInPlaceUpgrade: 1
TestTinkerbellKubernetes127UbuntuTo128SingleNodeInPlaceUpgrade: 1
TestTinkerbellKubernetes128UbuntuTo129SingleNodeInPlaceUpgrade: 1
TestTinkerbellKubernetes128UpgradeManagementComponents: 2
TestTinkerbellKubernetes128UpgradeManagementComponents: 2
TestTinkerbellKubernetes125UbuntuTo129MultipleUpgrade: 4
58 changes: 58 additions & 0 deletions test/e2e/tinkerbell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1649,3 +1649,61 @@ func TestTinkerbellKubernetes128UpgradeManagementComponents(t *testing.T) {
test.RunEKSA([]string{"upgrade", "management-components", "-f", test.ClusterConfigLocation, "-v", "99"})
test.DeleteCluster()
}

// TestTinkerbellKubernetes125UbuntuTo129MultipleUpgrade creates a single 1.25 cluster and upgrades it
// all the way until 1.29. This tests each K8s version upgrade in a single test and saves up
// hardware which would otherwise be needed for each test as part of both create and upgrade.
func TestTinkerbellKubernetes125UbuntuTo129MultipleUpgrade(t *testing.T) {
var kube126clusterOpts []framework.ClusterE2ETestOpt
var kube127clusterOpts []framework.ClusterE2ETestOpt
var kube128clusterOpts []framework.ClusterE2ETestOpt
var kube129clusterOpts []framework.ClusterE2ETestOpt
provider := framework.NewTinkerbell(t, framework.WithUbuntu125Tinkerbell())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube125)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
framework.WithControlPlaneHardware(2),
framework.WithWorkerHardware(2),
).WithClusterConfig(
provider.WithKubeVersionAndOS(v1alpha1.Kube125, framework.Ubuntu2004, nil),
)

kube126clusterOpts = append(
kube126clusterOpts,
framework.WithClusterUpgrade(
api.WithKubernetesVersion(v1alpha1.Kube126),
),
provider.WithProviderUpgrade(framework.Ubuntu126Image()),
)
kube127clusterOpts = append(
kube127clusterOpts,
framework.WithClusterUpgrade(
api.WithKubernetesVersion(v1alpha1.Kube127),
),
provider.WithProviderUpgrade(framework.Ubuntu127Image()),
)
kube128clusterOpts = append(
kube128clusterOpts,
framework.WithClusterUpgrade(
api.WithKubernetesVersion(v1alpha1.Kube128),
),
provider.WithProviderUpgrade(framework.Ubuntu128Image()),
)
kube129clusterOpts = append(
kube129clusterOpts,
framework.WithClusterUpgrade(
api.WithKubernetesVersion(v1alpha1.Kube129),
),
provider.WithProviderUpgrade(framework.Ubuntu129Image()),
)
runMultipleUpgradesFlowForBareMetal(
test,
kube126clusterOpts,
kube127clusterOpts,
kube128clusterOpts,
kube129clusterOpts,
)
}
13 changes: 13 additions & 0 deletions test/e2e/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ func runInPlaceUpgradeFlowForBareMetal(test *framework.ClusterE2ETest, clusterOp
test.ValidateHardwareDecommissioned()
}

func runMultipleUpgradesFlowForBareMetal(test *framework.ClusterE2ETest, clusterOpts ...[]framework.ClusterE2ETestOpt) {
test.GenerateHardwareConfig()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
for _, opts := range clusterOpts {
test.UpgradeClusterWithNewConfig(opts)
test.GenerateSupportBundleOnCleanupIfTestFailed()
test.ValidateClusterState()
test.StopIfFailed()
}
test.DeleteCluster()
test.ValidateHardwareDecommissioned()
}

// runSimpleUpgradeFlowForBaremetalWithoutClusterConfigGeneration runs the Create, Upgrade and Delete cluster flows
// for Baremetal that use the cluster config generated by the WithClusterConfig method when the test object is created,
// and avoids regenerating a cluster config with defaults.
Expand Down

0 comments on commit 058237c

Please sign in to comment.