Skip to content

Commit 2f9b2ae

Browse files
committed
feat(alb): fix testcases
1 parent 4cdc646 commit 2f9b2ae

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

internal/cmd/beta/alb/create/create.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
8585
// Wait for async operation, if async mode not enabled
8686
if !model.Async {
8787
s := spinner.New(p)
88-
s.Start("Creating zone")
88+
s.Start("Creating loadbalancer")
8989
_, err = wait.CreateOrUpdateLoadbalancerWaitHandler(ctx, apiClient, model.ProjectId, model.Region, *resp.Name).WaitWithContext(ctx)
9090
if err != nil {
9191
return fmt.Errorf("wait for loadbalancer creation: %w", err)
@@ -135,8 +135,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClie
135135
if err != nil {
136136
return req, err
137137
}
138-
req = req.CreateLoadBalancerPayload(payload)
139-
return req, nil
138+
return req.CreateLoadBalancerPayload(payload), nil
140139
}
141140

142141
func readPayload(ctx context.Context, model *inputModel) (payload alb.CreateLoadBalancerPayload, err error) {

internal/cmd/beta/alb/create/create_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func TestBuildRequest(t *testing.T) {
199199
Configuration: &testConfig,
200200
},
201201
expectedRequest: testClient.
202-
CreateLoadBalancer(context.Background(), testProjectId, testRegion).
202+
CreateLoadBalancer(testCtx, testProjectId, testRegion).
203203
CreateLoadBalancerPayload(fixturePayload()),
204204
},
205205
}
@@ -214,7 +214,6 @@ func TestBuildRequest(t *testing.T) {
214214
diff := cmp.Diff(request, tt.expectedRequest,
215215
cmp.AllowUnexported(tt.expectedRequest),
216216
cmpopts.EquateComparable(testCtx),
217-
cmpopts.IgnoreFields(alb.ApiCreateLoadBalancerRequest{}, "ctx"),
218217
)
219218
if diff != "" {
220219
t.Fatalf("Data does not match: %s", diff)
@@ -240,7 +239,7 @@ func TestOutputResult(t *testing.T) {
240239
wantErr: true,
241240
},
242241
{
243-
name: "only zone response as argument",
242+
name: "empty response as argument",
244243
args: args{
245244
model: fixtureInputModel(),
246245
resp: &alb.LoadBalancer{},

0 commit comments

Comments
 (0)