Skip to content

Commit

Permalink
Refactor Cluster Autoscaler Tinkerbell Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmeier5 committed Oct 20, 2023
1 parent 9193e87 commit 221bf82
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
22 changes: 19 additions & 3 deletions test/e2e/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@ import (
"github.com/aws/eks-anywhere/test/framework"
)

const (
autoscalerName = "cluster-autoscaler"
metricServerName = "metrics-server"
targetNamespace = "eksa-packages"
)

func runAutoscalerWithMetricsServerSimpleFlow(test *framework.ClusterE2ETest) {
test.WithCluster(func(e *framework.ClusterE2ETest) {
autoscalerName := "cluster-autoscaler"
metricServerName := "metrics-server"
targetNamespace := "eksa-packages"
test.InstallAutoScalerWithMetricServer(targetNamespace)
test.CombinedAutoScalerMetricServerTest(autoscalerName, metricServerName, targetNamespace, withMgmtCluster(test))
})
}

func runAutoscalerWithMetricsServerTinkerbellSimpleFlow(test *framework.ClusterE2ETest) {
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.GenerateClusterConfig()
test.PowerOnHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
test.InstallAutoScalerWithMetricServer(targetNamespace)
test.CombinedAutoScalerMetricServerTest(autoscalerName, metricServerName, targetNamespace, withMgmtCluster(test))
test.DeleteCluster()
test.PowerOffHardware()
test.ValidateHardwareDecommissioned()
}
4 changes: 2 additions & 2 deletions test/e2e/tinkerbell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func TestTinkerbellKubernetes127UbuntuCuratedPackagesClusterAutoscalerSimpleFlow
EksaPackageControllerHelmChartName, EksaPackageControllerHelmURI,
EksaPackageControllerHelmVersion, EksaPackageControllerHelmValues, nil),
)
runAutoscalerWithMetricsServerSimpleFlow(test)
runAutoscalerWithMetricsServerTinkerbellSimpleFlow(test)
}

func TestTinkerbellKubernetes126UbuntuSingleNodeCuratedPackagesFlow(t *testing.T) {
Expand Down Expand Up @@ -953,7 +953,7 @@ func TestTinkerbellKubernetes128UbuntuCuratedPackagesClusterAutoscalerSimpleFlow
EksaPackageControllerHelmChartName, EksaPackageControllerHelmURI,
EksaPackageControllerHelmVersion, EksaPackageControllerHelmValues, nil),
)
runAutoscalerWithMetricsServerSimpleFlow(test)
runAutoscalerWithMetricsServerTinkerbellSimpleFlow(test)
}

// Single node
Expand Down
2 changes: 1 addition & 1 deletion test/framework/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,7 @@ func (e *ClusterE2ETest) CombinedAutoScalerMetricServerTest(autoscalerName, metr
e.T.Fatalf("Failed waiting for test workload deployent %s", err)
}

params := []string{"autoscale", "deployment", name, "--cpu-percent=50", "--min=1", "--max=20", "--kubeconfig", e.KubeconfigFilePath()}
params := []string{"autoscale", "deployment", name, "--cpu-percent=50", "--min=1", "--max=150", "--kubeconfig", e.KubeconfigFilePath()}
_, err = e.KubectlClient.ExecuteCommand(ctx, params...)
if err != nil {
e.T.Fatalf("Failed to autoscale deployent: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion test/framework/testdata/hpa_busybox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
cpu: 50m
requests:
cpu: 10m
memory: 500Mi
memory: 1000Mi
command: ["sh", "-c"]
args:
- while [ 1 ]; do
Expand Down

0 comments on commit 221bf82

Please sign in to comment.