Skip to content

Commit ff88d56

Browse files
committed
adjust tests for new interfaces
1 parent 4a8e735 commit ff88d56

File tree

21 files changed

+29
-32
lines changed

21 files changed

+29
-32
lines changed

internal/cmd/beta/alb/list/list_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"strconv"
66
"testing"
77

8+
"github.com/google/go-cmp/cmp/cmpopts"
89
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
910
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1011
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1112

1213
"github.com/google/go-cmp/cmp"
13-
"github.com/google/go-cmp/cmp/cmpopts"
1414
"github.com/google/uuid"
1515
"github.com/stackitcloud/stackit-sdk-go/services/alb"
1616
)
@@ -49,7 +49,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4949
}
5050

5151
func fixtureRequest(mods ...func(request *alb.ApiListLoadBalancersRequest)) alb.ApiListLoadBalancersRequest {
52-
request := testClient.ListLoadBalancers(context.Background(), testProjectId, testRegion)
52+
request := testClient.ListLoadBalancers(testCtx, testProjectId, testRegion)
5353
for _, mod := range mods {
5454
mod(&request)
5555
}
@@ -160,7 +160,6 @@ func TestBuildRequest(t *testing.T) {
160160
diff := cmp.Diff(request, tt.expectedRequest,
161161
cmp.AllowUnexported(tt.expectedRequest),
162162
cmpopts.EquateComparable(testCtx),
163-
cmpopts.IgnoreFields(alb.ApiListLoadBalancersRequest{}, "ctx"),
164163
)
165164
if diff != "" {
166165
t.Fatalf("Data does not match: %s", diff)

internal/cmd/beta/alb/plans/plans_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func TestBuildRequest(t *testing.T) {
156156
diff := cmp.Diff(request, tt.expectedRequest,
157157
cmp.AllowUnexported(tt.expectedRequest),
158158
cmpopts.EquateComparable(testCtx),
159-
cmpopts.IgnoreFields(alb.ApiListLoadBalancersRequest{}, "ctx"),
160159
)
161160
if diff != "" {
162161
t.Fatalf("Data does not match: %s", diff)

internal/cmd/beta/alb/quotas/quotas_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func TestBuildRequest(t *testing.T) {
156156
diff := cmp.Diff(request, tt.expectedRequest,
157157
cmp.AllowUnexported(tt.expectedRequest),
158158
cmpopts.EquateComparable(testCtx),
159-
cmpopts.IgnoreFields(alb.ApiListLoadBalancersRequest{}, "ctx"),
160159
)
161160
if diff != "" {
162161
t.Fatalf("Data does not match: %s", diff)

internal/cmd/git/create/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func TestBuildRequest(t *testing.T) {
184184
model.Name = "new-name"
185185
}),
186186
expectedRequest: fixtureRequest(func(request *git.ApiCreateInstanceRequest) {
187-
*request = request.CreateInstancePayload(fixtureCreatePayload(func(payload *git.CreateInstancePayload) {
187+
*request = (*request).CreateInstancePayload(fixtureCreatePayload(func(payload *git.CreateInstancePayload) {
188188
payload.Name = utils.Ptr("new-name")
189189
}))
190190
}),

internal/cmd/image/create/create_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ func TestBuildRequest(t *testing.T) {
339339
model.Labels = nil
340340
}),
341341
expectedRequest: fixtureRequest(func(request *iaas.ApiCreateImageRequest) {
342-
*request = request.CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
342+
*request = (*request).CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
343343
payload.Labels = nil
344344
}))
345345
}),
@@ -350,7 +350,7 @@ func TestBuildRequest(t *testing.T) {
350350
model.Config.CdromBus = utils.Ptr("foobar")
351351
}),
352352
expectedRequest: fixtureRequest(func(request *iaas.ApiCreateImageRequest) {
353-
*request = request.CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
353+
*request = (*request).CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
354354
payload.Config.CdromBus = iaas.NewNullableString(utils.Ptr("foobar"))
355355
}))
356356
}),
@@ -361,7 +361,7 @@ func TestBuildRequest(t *testing.T) {
361361
model.Config.Uefi = false
362362
}),
363363
expectedRequest: fixtureRequest(func(request *iaas.ApiCreateImageRequest) {
364-
*request = request.CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
364+
*request = (*request).CreateImagePayload(fixtureCreatePayload(func(payload *iaas.CreateImagePayload) {
365365
payload.Config.Uefi = utils.Ptr(false)
366366
}))
367367
}),

internal/cmd/image/list/list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func TestBuildRequest(t *testing.T) {
184184
model.LabelSelector = utils.Ptr("")
185185
}),
186186
expectedRequest: fixtureRequest(func(request *iaas.ApiListImagesRequest) {
187-
*request = request.LabelSelector("")
187+
*request = (*request).LabelSelector("")
188188
}),
189189
},
190190
{
@@ -193,7 +193,7 @@ func TestBuildRequest(t *testing.T) {
193193
model.LabelSelector = utils.Ptr("foo=bar")
194194
}),
195195
expectedRequest: fixtureRequest(func(request *iaas.ApiListImagesRequest) {
196-
*request = request.LabelSelector("foo=bar")
196+
*request = (*request).LabelSelector("foo=bar")
197197
}),
198198
},
199199
}

internal/cmd/image/update/update_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func TestBuildRequest(t *testing.T) {
373373
model.Labels = nil
374374
}),
375375
expectedRequest: fixtureRequest(func(request *iaas.ApiUpdateImageRequest) {
376-
*request = request.UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
376+
*request = (*request).UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
377377
payload.Labels = nil
378378
}))
379379
}),
@@ -384,7 +384,7 @@ func TestBuildRequest(t *testing.T) {
384384
model.Name = utils.Ptr("something else")
385385
}),
386386
expectedRequest: fixtureRequest(func(request *iaas.ApiUpdateImageRequest) {
387-
*request = request.UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
387+
*request = (*request).UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
388388
payload.Name = utils.Ptr("something else")
389389
}))
390390
}),
@@ -395,7 +395,7 @@ func TestBuildRequest(t *testing.T) {
395395
model.Config.CdromBus = utils.Ptr("something else")
396396
}),
397397
expectedRequest: fixtureRequest(func(request *iaas.ApiUpdateImageRequest) {
398-
*request = request.UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
398+
*request = (*request).UpdateImagePayload(fixtureCreatePayload(func(payload *iaas.UpdateImagePayload) {
399399
payload.Config.CdromBus.Set(utils.Ptr("something else"))
400400
}))
401401
}),

internal/cmd/load-balancer/observability-credentials/add/add_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func TestBuildRequest(t *testing.T) {
189189
diff := cmp.Diff(request, tt.expectedRequest,
190190
cmp.AllowUnexported(tt.expectedRequest),
191191
cmpopts.EquateComparable(testCtx),
192-
cmpopts.IgnoreFields(loadbalancer.ApiCreateCredentialsRequest{}, "xRequestID"),
192+
cmpopts.IgnoreFields(loadbalancer.CreateCredentialsRequest{}, "xRequestID"),
193193
)
194194
if diff != "" {
195195
t.Fatalf("Data does not match: %s", diff)

internal/cmd/load-balancer/target-pool/add-target/add_target_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func TestBuildRequest(t *testing.T) {
338338
},
339339
}
340340
})
341-
*request = request.UpdateTargetPoolPayload(*payload)
341+
*request = (*request).UpdateTargetPoolPayload(*payload)
342342
}),
343343
},
344344
{
@@ -357,7 +357,7 @@ func TestBuildRequest(t *testing.T) {
357357
},
358358
}
359359
})
360-
*request = request.UpdateTargetPoolPayload(*payload)
360+
*request = (*request).UpdateTargetPoolPayload(*payload)
361361
}),
362362
},
363363
{
@@ -376,7 +376,7 @@ func TestBuildRequest(t *testing.T) {
376376
},
377377
}
378378
})
379-
*request = request.UpdateTargetPoolPayload(*payload)
379+
*request = (*request).UpdateTargetPoolPayload(*payload)
380380
}),
381381
},
382382
{

internal/cmd/load-balancer/target-pool/remove-target/remove_target_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func TestBuildRequest(t *testing.T) {
320320
payload := fixturePayload(func(payload *loadbalancer.UpdateTargetPoolPayload) {
321321
payload.Targets = utils.Ptr((*payload.Targets)[1:])
322322
})
323-
*request = request.UpdateTargetPoolPayload(*payload)
323+
*request = (*request).UpdateTargetPoolPayload(*payload)
324324
}),
325325
},
326326
{

0 commit comments

Comments
 (0)