Skip to content

Commit

Permalink
Clean up funcs around power on and off: (#7512)
Browse files Browse the repository at this point in the history
* Clean up funcs around power on and off:

Removed skipped tinkerbell tests that used power
on or off. Removed power on and off from all other
tests. We should not be powering on or off machines
manually. ValidateHardwareDecommissioned will now
validate machines are off and then if any are not
off we call powerOffHardware and fail the test. We
power off so that subsequent runs won't have issues
with multiple Boots DHCP servers running.

Also updated the logic around checking the response
from bmclib for power state. Depending on the provider
the power state comes back different. For example, with
ipmitool the result will be "Chassis Power is off", while
with redfish the result will be "off".

Signed-off-by: Jacob Weinstock <[email protected]>

* Update func comment for ValidateHardwareDecommissioned

Signed-off-by: Jacob Weinstock <[email protected]>

---------

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock authored Feb 7, 2024
1 parent 42d21c6 commit c084194
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 189 deletions.
4 changes: 0 additions & 4 deletions test/e2e/SKIPPED_TESTS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ skipped_tests:
# Skipping ETCD tests
- TestTinkerbellKubernetes126UbuntuExternalEtcdSimpleFlow
# Skipping skip power action tests - Not going to work because e2e test powers on CP and worker node at the same time and worker node times out early waiting for ipxe
- TestTinkerbellKubernetes128SkipPowerActions
- TestTinkerbellKubernetes128WithNodesPoweredOn
# Skipping a few redundant tests
- TestTinkerbellKubernetes123RedHatSimpleFlow
- TestTinkerbellKubernetes125RedHatSimpleFlow
Expand All @@ -79,8 +77,6 @@ skipped_tests:
- TestTinkerbellKubernetes125To126Ubuntu2204Upgrade
- TestTinkerbellKubernetes126Ubuntu2004To2204Upgrade
- TestTinkerbellKubernetes126UbuntuThreeWorkersSimpleFlow
- TestTinkerbellKubernetes128SkipPowerActions
- TestTinkerbellKubernetes128SingleNodeSkipPowerActions
- TestTinkerbellKubernetes125UbuntuWorkerNodeScaleUpWithAPI
- TestTinkerbellKubernetes125UbuntuAddWorkerNodeGroupWithAPI
- TestTinkerbellSingleNode125ManagementScaleupWorkloadWithAPI
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/TINKERBELL_HARDWARE_COUNT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ TestTinkerbellUpgrade128MulticlusterWorkloadClusterCPScaleup: 6
TestTinkerbellUpgrade128MulticlusterWorkloadClusterWorkerScaleDown: 5
TestTinkerbellUpgradeMulticlusterWorkloadClusterK8sUpgrade127To128: 6
TestTinkerbellUpgradeMulticlusterWorkloadClusterK8sUpgrade125To126WithAPI: 4
TestTinkerbellKubernetes128WithNodesPoweredOn: 2
TestTinkerbellKubernetes128OIDC: 2
TestTinkerbellKubernetes128UbuntuRegistryMirror: 2
TestTinkerbellKubernetes128UbuntuInsecureSkipVerifyRegistryMirror: 2
Expand All @@ -100,8 +99,6 @@ TestTinkerbellKubernetes128UbuntuThreeControlPlaneReplicasSimpleFlow: 4
TestTinkerbellKubernetes128BottleRocketThreeControlPlaneReplicasSimpleFlow: 4
TestTinkerbellKubernetes128UbuntuThreeWorkersSimpleFlow: 4
TestTinkerbellKubernetes128BottleRocketThreeWorkersSimpleFlow: 4
TestTinkerbellKubernetes128SkipPowerActions: 2
TestTinkerbellKubernetes128SingleNodeSkipPowerActions: 1
TestTinkerbellKubernetes128UbuntuControlPlaneScaleUp: 4
TestTinkerbellKubernetes128UbuntuWorkerNodeScaleUp: 3
TestTinkerbellKubernetes128UbuntuWorkerNodeScaleDown: 3
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/adot.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ func runCuratedPackagesAdotInstallUpdateFlow(test *framework.ClusterE2ETest) {
func runCuratedPackagesAdotInstallTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
runCuratedPackagesAdotInstall(test)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
2 changes: 0 additions & 2 deletions test/e2e/airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs, k
framework.WithBundlesOverride(bundleReleasePathFromArtifacts),
)
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.AirgapDockerContainers(localCIDRs)
test.CreateAirgappedUser(localCIDRs)
test.AssertAirgappedNetwork()
Expand Down Expand Up @@ -86,7 +85,6 @@ func runTinkerbellAirgapConfigProxyFlow(test *framework.ClusterE2ETest, localCID

test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.AirgapDockerContainers(localCIDRs)
test.CreateAirgappedUser(localCIDRs)
test.AssertAirgappedNetwork()
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ func runAutoscalerWithMetricsServerSimpleFlow(test *framework.ClusterE2ETest) {
func runAutoscalerWithMetricsServerTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
autoscalerName := "cluster-autoscaler"
metricServerName := "metrics-server"
targetNamespace := "eksa-packages"
test.InstallAutoScalerWithMetricServer(targetNamespace)
test.CombinedAutoScalerMetricServerTest(autoscalerName, metricServerName, targetNamespace, withMgmtCluster(test))
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
1 change: 0 additions & 1 deletion test/e2e/awsiamauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func runUpgradeFlowWithAWSIamAuth(test *framework.ClusterE2ETest, updateVersion
func runTinkerbellAWSIamAuthFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateAWSIamAuth()
test.StopIfFailed()
Expand Down
1 change: 0 additions & 1 deletion test/e2e/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func runConformanceFlow(test *framework.ClusterE2ETest) {
func runTinkerbellConformanceFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.RunConformanceTests()
test.StopIfFailed()
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/curatedpackages.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ func runCuratedPackageRemoteClusterInstallSimpleFlow(test *framework.Multicluste
func runCuratedPackageInstallTinkerbellSingleNodeFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
runCuratedPackageInstall(test)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}

Expand Down
2 changes: 0 additions & 2 deletions test/e2e/emissary.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ func runCuratedPackageEmissaryRemoteClusterInstallSimpleFlow(test *framework.Mul
func runCuratedPackageEmissaryInstallTinkerbellSingleNodeFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
runCuratedPackageEmissaryInstall(test)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
2 changes: 0 additions & 2 deletions test/e2e/harbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ func runCuratedPackageHarborInstall(test *framework.ClusterE2ETest) {
func runCuratedPackageHarborInstallTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
runCuratedPackageHarborInstall(test)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
28 changes: 1 addition & 27 deletions test/e2e/multicluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func runWorkloadClusterGitOpsAPIFlowForBareMetal(test *framework.MulticlusterE2E
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.WaitForAvailableHardware()
w.PowerOffHardware()
test.PushWorkloadClusterToGit(w)
w.WaitForKubeconfig()
w.ValidateClusterState()
Expand All @@ -75,7 +74,6 @@ func runWorkloadClusterGitOpsAPIUpgradeFlowForBareMetal(test *framework.Multiclu
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.WaitForAvailableHardware()
w.PowerOffHardware()
test.PushWorkloadClusterToGit(w)
w.WaitForKubeconfig()
w.ValidateClusterState()
Expand All @@ -93,7 +91,6 @@ func runTinkerbellWorkloadClusterFlow(test *framework.MulticlusterE2ETest) {
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.GenerateClusterConfig()
w.PowerOffHardware()
w.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
w.StopIfFailed()
w.DeleteCluster()
Expand All @@ -106,7 +103,6 @@ func runWorkloadClusterWithAPIFlowForBareMetal(test *framework.MulticlusterE2ETe
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.WaitForAvailableHardware()
w.PowerOffHardware()
w.ApplyClusterManifest()
w.WaitForKubeconfig()
w.ValidateClusterState()
Expand All @@ -122,7 +118,6 @@ func runSimpleWorkloadUpgradeFlowForBareMetal(test *framework.MulticlusterE2ETes
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.GenerateClusterConfig()
w.PowerOffHardware()
w.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
time.Sleep(2 * time.Minute)
w.UpgradeCluster(clusterOpts)
Expand All @@ -139,7 +134,6 @@ func runWorkloadClusterUpgradeFlowWithAPIForBareMetal(test *framework.Multiclust
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.WaitForAvailableHardware()
w.PowerOffHardware()
w.ApplyClusterManifest()
w.WaitForKubeconfig()
w.ValidateClusterState()
Expand All @@ -152,24 +146,4 @@ func runWorkloadClusterUpgradeFlowWithAPIForBareMetal(test *framework.Multiclust
})
test.ManagementCluster.StopIfFailed()
test.DeleteManagementCluster()
}

func runTinkerbellWorkloadClusterFlowSkipPowerActions(test *framework.MulticlusterE2ETest) {
test.ManagementCluster.GenerateClusterConfig()
test.CreateTinkerbellManagementCluster()
test.RunInWorkloadClusters(func(w *framework.WorkloadCluster) {
w.GenerateClusterConfig()
w.PowerOffHardware()
w.PXEBootHardware()
w.PowerOnHardware()
w.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
w.StopIfFailed()
w.DeleteCluster()
w.PowerOffHardware()
w.ValidateHardwareDecommissioned()
})
test.ManagementCluster.StopIfFailed()
test.ManagementCluster.DeleteCluster()
test.ManagementCluster.PowerOffHardware()
test.ManagementCluster.ValidateHardwareDecommissioned()
}
}
1 change: 0 additions & 1 deletion test/e2e/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func runOIDCFlow(test *framework.ClusterE2ETest) {
func runTinkerbellOIDCFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateOIDC()
test.StopIfFailed()
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ func runCuratedPackagesPrometheusUpdateFlow(test *framework.ClusterE2ETest) {
func runCuratedPackagesPrometheusInstallTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
runCuratedPackagesPrometheusInstall(test)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
1 change: 0 additions & 1 deletion test/e2e/registrymirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func runTinkerbellRegistryMirrorFlow(test *framework.ClusterE2ETest) {
test.DownloadImages()
test.ImportImages()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
test.StopIfFailed()
test.DeleteCluster(framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/simpleflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func runSimpleFlowWithoutClusterConfigGeneration(test *framework.ClusterE2ETest)
func runTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.DeleteCluster()
test.ValidateHardwareDecommissioned()
Expand All @@ -35,7 +34,6 @@ func runTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
// test object is created, and avoids regenerating a cluster config with defaults.
func runTinkerbellSimpleFlowWithoutClusterConfigGeneration(test *framework.ClusterE2ETest) {
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.DeleteCluster()
test.ValidateHardwareDecommissioned()
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/singlenode.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
func runTinkerbellSingleNodeFlow(test *framework.ClusterE2ETest) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneNoTaints, framework.ValidateControlPlaneLabels)
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
62 changes: 0 additions & 62 deletions test/e2e/tinkerbell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,25 +909,6 @@ func TestTinkerbellUpgradeMulticlusterWorkloadClusterK8sUpgrade127To128(t *testi
)
}

// Nodes powered on
func TestTinkerbellKubernetes128WithNodesPoweredOn(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewTinkerbell(t, framework.WithUbuntu128Tinkerbell()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
framework.WithControlPlaneHardware(1),
framework.WithWorkerHardware(1),
)

test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.DeleteCluster()
test.ValidateHardwareDecommissioned()
}

// OIDC
func TestTinkerbellKubernetes128OIDC(t *testing.T) {
test := framework.NewClusterE2ETest(
Expand Down Expand Up @@ -1156,48 +1137,6 @@ func TestTinkerbellKubernetes128UbuntuThreeWorkersSimpleFlow(t *testing.T) {
runTinkerbellSimpleFlow(test)
}

// Skip power actions
func TestTinkerbellKubernetes128SkipPowerActions(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewTinkerbell(t, framework.WithUbuntu128Tinkerbell()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
framework.WithNoPowerActions(),
framework.WithControlPlaneHardware(1),
framework.WithWorkerHardware(1),
)

test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.PXEBootHardware()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}

func TestTinkerbellKubernetes128SingleNodeSkipPowerActions(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewTinkerbell(t, framework.WithUbuntu128Tinkerbell()),
framework.WithClusterSingleNode(v1alpha1.Kube128),
framework.WithNoPowerActions(),
framework.WithControlPlaneHardware(1),
)

test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.PXEBootHardware()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}

func TestTinkerbellKubernetes128UbuntuControlPlaneScaleUp(t *testing.T) {
provider := framework.NewTinkerbell(t, framework.WithUbuntu128Tinkerbell())
test := framework.NewClusterE2ETest(
Expand Down Expand Up @@ -1295,7 +1234,6 @@ func TestTinkerbellKubernetes128UbuntuWorkerNodeGroupsTaintsAndLabels(t *testing

test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.ValidateWorkerNodes(framework.ValidateWorkerNodeTaints, framework.ValidateWorkerNodeLabels)
test.ValidateControlPlaneNodes(framework.ValidateControlPlaneTaints, framework.ValidateControlPlaneLabels)
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func runUpgradeFlowWithCheckpoint(test *framework.ClusterE2ETest, updateVersion
func runSimpleUpgradeFlowForBareMetal(test *framework.ClusterE2ETest, updateVersion v1alpha1.KubernetesVersion, clusterOpts ...framework.ClusterE2ETestOpt) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.UpgradeClusterWithNewConfig(clusterOpts)
test.ValidateCluster(updateVersion)
Expand All @@ -53,7 +52,6 @@ func runSimpleUpgradeFlowForBareMetal(test *framework.ClusterE2ETest, updateVers

func runSimpleUpgradeFlowWorkerNodeVersionForBareMetal(test *framework.ClusterE2ETest, clusterOpts ...framework.ClusterE2ETestOpt) {
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.UpgradeClusterWithNewConfig(clusterOpts)
test.ValidateClusterState()
Expand All @@ -67,7 +65,6 @@ func runSimpleUpgradeFlowWorkerNodeVersionForBareMetal(test *framework.ClusterE2
// and avoids regenerating a cluster config with defaults.
func runSimpleUpgradeFlowForBaremetalWithoutClusterConfigGeneration(test *framework.ClusterE2ETest, updateVersion v1alpha1.KubernetesVersion, clusterOpts ...framework.ClusterE2ETestOpt) {
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.UpgradeClusterWithNewConfig(clusterOpts)
test.ValidateCluster(updateVersion)
Expand All @@ -89,7 +86,6 @@ func runUpgradeFlowWithAPI(test *framework.ClusterE2ETest, fillers ...api.Cluste
func runUpgradeFlowForBareMetalWithAPI(test *framework.ClusterE2ETest, fillers ...api.ClusterConfigFiller) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.LoadClusterConfigGeneratedByCLI()
test.UpdateClusterConfig(fillers...)
Expand Down
Loading

0 comments on commit c084194

Please sign in to comment.