diff --git a/internal/namespaces/k8s/v1/custom_cluster_test.go b/internal/namespaces/k8s/v1/custom_cluster_test.go index 401374f09f..9d33d705f1 100644 --- a/internal/namespaces/k8s/v1/custom_cluster_test.go +++ b/internal/namespaces/k8s/v1/custom_cluster_test.go @@ -8,12 +8,9 @@ import ( func Test_WaitCluster(t *testing.T) { t.Run("wait for pools", core.Test(&core.TestConfig{ - Commands: GetCommands(), - BeforeFunc: core.ExecStoreBeforeCmd( - "Cluster", - "scw k8s cluster create name=cli-test version=1.18.5 cni=cilium pools.0.node-type=DEV1-M pools.0.size=3 pools.0.name=default", - ), - Cmd: "scw k8s cluster wait {{ .Cluster.ID }} wait-for-pools=true", + Commands: GetCommands(), + BeforeFunc: createCluster("Cluster", kapsuleVersion, 3), + Cmd: "scw k8s cluster wait {{ .Cluster.ID }} wait-for-pools=true", Check: core.TestCheckCombine( core.TestCheckGolden(), core.TestCheckExitCode(0), diff --git a/internal/namespaces/k8s/v1/helpers_test.go b/internal/namespaces/k8s/v1/helpers_test.go index 08f1c35619..7086ba5d60 100644 --- a/internal/namespaces/k8s/v1/helpers_test.go +++ b/internal/namespaces/k8s/v1/helpers_test.go @@ -17,6 +17,14 @@ const ( // Clusters // +// createCluster creates a basic cluster with "poolSize" dev1-m as nodes, the given version and +// register it in the context Meta at metaKey. +func createCluster(metaKey string, version string, poolSize int) core.BeforeFunc { + return core.ExecStoreBeforeCmd( + metaKey, + fmt.Sprintf("scw k8s cluster create name=cli-test version=%s cni=cilium pools.0.node-type=DEV1-M pools.0.size=%d pools.0.name=default", version, poolSize)) +} + // createClusterAndWaitAndKubeconfig creates a basic cluster with 1 dev1-m as node, the given version and // register it in the context Meta at metaKey. func createClusterAndWaitAndKubeconfig(metaKey string, kubeconfigMetaKey string, version string) core.BeforeFunc {