@@ -16,8 +16,6 @@ import (
1616 "github.com/stackitcloud/stackit-sdk-go/services/mariadb"
1717)
1818
19- var projectIdFlag = globalflags .ProjectIdFlag
20-
2119type testCtxKey struct {}
2220
2321var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
@@ -27,9 +25,9 @@ var testInstanceId = uuid.NewString()
2725
2826func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
2927 flagValues := map [string ]string {
30- projectIdFlag : testProjectId ,
31- instanceIdFlag : testInstanceId ,
32- limitFlag : "10" ,
28+ globalflags . ProjectIdFlag : testProjectId ,
29+ instanceIdFlag : testInstanceId ,
30+ limitFlag : "10" ,
3331 }
3432 for _ , mod := range mods {
3533 mod (flagValues )
@@ -82,21 +80,21 @@ func TestParseInput(t *testing.T) {
8280 {
8381 description : "project id missing" ,
8482 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
85- delete (flagValues , projectIdFlag )
83+ delete (flagValues , globalflags . ProjectIdFlag )
8684 }),
8785 isValid : false ,
8886 },
8987 {
9088 description : "project id invalid 1" ,
9189 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
92- flagValues [projectIdFlag ] = ""
90+ flagValues [globalflags . ProjectIdFlag ] = ""
9391 }),
9492 isValid : false ,
9593 },
9694 {
9795 description : "project id invalid 2" ,
9896 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
99- flagValues [projectIdFlag ] = "invalid-uuid"
97+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
10098 }),
10199 isValid : false ,
102100 },
@@ -174,8 +172,9 @@ func TestBuildRequest(t *testing.T) {
174172
175173func TestOutputResult (t * testing.T ) {
176174 type args struct {
177- outputFormat string
178- credentials []mariadb.CredentialsListItem
175+ outputFormat string
176+ instanceLabel string
177+ credentials []mariadb.CredentialsListItem
179178 }
180179 tests := []struct {
181180 name string
@@ -207,7 +206,7 @@ func TestOutputResult(t *testing.T) {
207206 p .Cmd = NewCmd (& params.CmdParams {Printer : p })
208207 for _ , tt := range tests {
209208 t .Run (tt .name , func (t * testing.T ) {
210- if err := outputResult (p , tt .args .outputFormat , tt .args .credentials ); (err != nil ) != tt .wantErr {
209+ if err := outputResult (p , tt .args .outputFormat , tt .args .instanceLabel , tt . args . credentials ); (err != nil ) != tt .wantErr {
211210 t .Errorf ("outputResult() error = %v, wantErr %v" , err , tt .wantErr )
212211 }
213212 })
0 commit comments