1
1
package clients
2
2
3
3
import (
4
+ "context"
4
5
"fmt"
5
6
"io"
6
7
"net/http"
@@ -24,23 +25,25 @@ func TestSTACKITCLIFlow_Init(t *testing.T) {
24
25
}
25
26
for _ , tt := range tests {
26
27
t .Run (tt .name , func (t * testing.T ) {
28
+ ctx := context .TODO ()
29
+
27
30
c := & STACKITCLIFlow {}
28
31
29
- _ , _ = runSTACKITCLICommand (t . Context () , "stackit config profile delete test-stackit-cli-flow-init -y" )
30
- _ , err := runSTACKITCLICommand (t . Context () , "stackit config profile create test-stackit-cli-flow-init" )
32
+ _ , _ = runSTACKITCLICommand (ctx , "stackit config profile delete test-stackit-cli-flow-init -y" )
33
+ _ , err := runSTACKITCLICommand (ctx , "stackit config profile create test-stackit-cli-flow-init" )
31
34
if err != nil {
32
35
t .Errorf ("runSTACKITCLICommand() error = %v" , err )
33
36
return
34
37
}
35
38
36
- _ , err = runSTACKITCLICommand (t . Context () , "stackit auth activate-service-account --service-account-token=" + testServiceAccountToken )
39
+ _ , err = runSTACKITCLICommand (ctx , "stackit auth activate-service-account --service-account-token=" + testServiceAccountToken )
37
40
if err != nil {
38
41
t .Errorf ("runSTACKITCLICommand() error = %v" , err )
39
42
return
40
43
}
41
44
42
45
defer func () {
43
- _ , _ = runSTACKITCLICommand (t . Context () , "stackit config profile delete test-stackit-cli-flow-init -y" )
46
+ _ , _ = runSTACKITCLICommand (ctx , "stackit config profile delete test-stackit-cli-flow-init -y" )
44
47
}()
45
48
46
49
if err := c .Init (tt .args .cfg ); (err != nil ) != tt .wantErr {
@@ -70,21 +73,23 @@ func TestSTACKITCLIFlow_Do(t *testing.T) {
70
73
}
71
74
for _ , tt := range tests {
72
75
t .Run (tt .name , func (t * testing.T ) {
73
- _ , _ = runSTACKITCLICommand (t .Context (), "stackit config profile delete test-stackit-cli-flow-do -y" )
74
- _ , err := runSTACKITCLICommand (t .Context (), "stackit config profile create test-stackit-cli-flow-do" )
76
+ ctx := context .TODO ()
77
+
78
+ _ , _ = runSTACKITCLICommand (ctx , "stackit config profile delete test-stackit-cli-flow-do -y" )
79
+ _ , err := runSTACKITCLICommand (ctx , "stackit config profile create test-stackit-cli-flow-do" )
75
80
if err != nil {
76
81
t .Errorf ("runSTACKITCLICommand() error = %v" , err )
77
82
return
78
83
}
79
84
80
- _ , err = runSTACKITCLICommand (t . Context () , "stackit auth activate-service-account --service-account-token=" + testServiceAccountToken )
85
+ _ , err = runSTACKITCLICommand (ctx , "stackit auth activate-service-account --service-account-token=" + testServiceAccountToken )
81
86
if err != nil {
82
87
t .Errorf ("runSTACKITCLICommand() error = %v" , err )
83
88
return
84
89
}
85
90
86
91
defer func () {
87
- _ , _ = runSTACKITCLICommand (t . Context () , "stackit config profile delete test-stackit-cli-flow-do -y" )
92
+ _ , _ = runSTACKITCLICommand (ctx , "stackit config profile delete test-stackit-cli-flow-do -y" )
88
93
}()
89
94
90
95
c := & STACKITCLIFlow {}
0 commit comments