@@ -17,11 +17,11 @@ func Test_GetKubeconfig(t *testing.T) {
1717 ////
1818 // Simple use case
1919 ////
20-
2120 t .Run ("simple" , core .Test (& core.TestConfig {
2221 Commands : k8s .GetCommands (),
23- BeforeFunc : createClusterAndWaitAndKubeconfig (
24- "get-kubeconfig-simple" ,
22+ BeforeFunc : core .BeforeFuncCombine (
23+ createCluster ("get-kubeconfig-simple" , true ),
24+ fetchClusterKubeconfigMetadata (true ),
2525 ),
2626 Cmd : "scw k8s kubeconfig get {{ ." + clusterMetaKey + ".ID }}" ,
2727 OverrideEnv : map [string ]string {
@@ -81,8 +81,9 @@ func Test_GetKubeconfig(t *testing.T) {
8181 ////
8282 t .Run ("with_flags" , core .Test (& core.TestConfig {
8383 Commands : k8s .GetCommands (),
84- BeforeFunc : createClusterAndWaitAndKubeconfig (
85- "get-kubeconfig-with-flags" ,
84+ BeforeFunc : core .BeforeFuncCombine (
85+ createCluster ("get-kubeconfig-with-flags" , true ),
86+ fetchClusterKubeconfigMetadata (true ),
8687 ),
8788 Cmd : "scw k8s --profile=default kubeconfig get {{ ." + clusterMetaKey + ".ID }}" ,
8889 OverrideEnv : map [string ]string {
@@ -147,8 +148,9 @@ func Test_GetKubeconfig(t *testing.T) {
147148
148149 t .Run ("with_envs" , core .Test (& core.TestConfig {
149150 Commands : k8s .GetCommands (),
150- BeforeFunc : createClusterAndWaitAndKubeconfig (
151- "get-kubeconfig-with-envs" ,
151+ BeforeFunc : core .BeforeFuncCombine (
152+ createCluster ("get-kubeconfig-with-envs" , true ),
153+ fetchClusterKubeconfigMetadata (true ),
152154 ),
153155 Cmd : "scw k8s kubeconfig get {{ ." + clusterMetaKey + ".ID }}" ,
154156 OverrideEnv : map [string ]string {
@@ -212,8 +214,9 @@ func Test_GetKubeconfig(t *testing.T) {
212214 ////
213215 t .Run ("with_flags_and_envs" , core .Test (& core.TestConfig {
214216 Commands : k8s .GetCommands (),
215- BeforeFunc : createClusterAndWaitAndKubeconfig (
216- "get-kubeconfig-with-flags-and-envs" ,
217+ BeforeFunc : core .BeforeFuncCombine (
218+ createCluster ("get-kubeconfig-with-flags-and-envs" , true ),
219+ fetchClusterKubeconfigMetadata (true ),
217220 ),
218221 Cmd : "scw --profile=default k8s kubeconfig get {{ ." + clusterMetaKey + ".ID }}" ,
219222 OverrideEnv : map [string ]string {
@@ -283,10 +286,12 @@ func Test_GetKubeconfig(t *testing.T) {
283286 t .Run ("legacy" , core .Test (& core.TestConfig {
284287 Commands : k8s .GetCommands (),
285288 Cmd : "scw k8s kubeconfig get {{ ." + clusterMetaKey + ".ID }} auth-method=legacy" ,
286- BeforeFunc : createClusterAndWaitAndKubeconfig (
287- "get-kubeconfig-legacy" ,
289+ BeforeFunc : core .BeforeFuncCombine (
290+ createCluster ("get-kubeconfig-legacy" , true ),
291+ fetchClusterKubeconfigMetadata (false ),
288292 ),
289293 Check : core .TestCheckCombine (
294+ core .TestCheckGolden (),
290295 core .TestCheckExitCode (0 ),
291296 func (t * testing.T , ctx * core.CheckFuncCtx ) {
292297 t .Helper ()
@@ -304,8 +309,9 @@ func Test_GetKubeconfig(t *testing.T) {
304309 ////
305310 t .Run ("copy_cli_token" , core .Test (& core.TestConfig {
306311 Commands : k8s .GetCommands (),
307- BeforeFunc : createClusterAndWaitAndKubeconfig (
308- "get-kubeconfig-copy-cli-token" ,
312+ BeforeFunc : core .BeforeFuncCombine (
313+ createCluster ("get-kubeconfig-copy-cli-token" , true ),
314+ fetchClusterKubeconfigMetadata (true ),
309315 ),
310316 Cmd : "scw k8s kubeconfig get {{ ." + clusterMetaKey + ".ID }} auth-method=copy-cli-token" ,
311317 OverrideEnv : map [string ]string {
0 commit comments