Skip to content

Commit 8f042b7

Browse files
author
Rahul Sharma
committed
fix existing failing unittests
1 parent c40c103 commit 8f042b7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cloud/linode/instances_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func TestMetadataRetrieval(t *testing.T) {
200200

201201
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{instance}, nil)
202202
client.EXPECT().ListVPCIPAddresses(gomock.Any(), vpcIDs["test"], gomock.Any()).Return(routesInVPC, nil)
203+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), vpcIDs["test"], gomock.Any()).Return([]linodego.VPCIP{}, nil)
203204

204205
meta, err := instances.InstanceMetadata(ctx, node)
205206
require.NoError(t, err)

cloud/linode/route_controller_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func TestListRoutes(t *testing.T) {
5252

5353
client.EXPECT().ListInstances(gomock.Any(), gomock.Any()).Times(1).Return([]linodego.Instance{}, nil)
5454
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return([]linodego.VPCIP{}, nil)
55+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
5556
routes, err := routeController.ListRoutes(ctx, "test")
5657
require.NoError(t, err)
5758
assert.Empty(t, routes)
@@ -76,6 +77,7 @@ func TestListRoutes(t *testing.T) {
7677

7778
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
7879
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return([]linodego.VPCIP{}, nil)
80+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
7981
routes, err := routeController.ListRoutes(ctx, "test")
8082
require.NoError(t, err)
8183
assert.Empty(t, routes)
@@ -103,6 +105,7 @@ func TestListRoutes(t *testing.T) {
103105

104106
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
105107
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(4).Return(noRoutesInVPC, nil)
108+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
106109
routes, err := routeController.ListRoutes(ctx, "test")
107110
require.NoError(t, err)
108111
assert.Empty(t, routes)
@@ -151,6 +154,7 @@ func TestListRoutes(t *testing.T) {
151154

152155
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
153156
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(4).Return(routesInVPC, nil)
157+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
154158
routes, err := routeController.ListRoutes(ctx, "test")
155159
require.NoError(t, err)
156160
assert.NotEmpty(t, routes)
@@ -199,6 +203,7 @@ func TestListRoutes(t *testing.T) {
199203

200204
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
201205
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(4).Return(routesInDifferentVPC, nil)
206+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
202207
routes, err := routeController.ListRoutes(ctx, "test")
203208
require.NoError(t, err)
204209
assert.Empty(t, routes)
@@ -297,6 +302,7 @@ func TestListRoutes(t *testing.T) {
297302
c2 := client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).After(c1).Times(1).Return(routesInVPC2, nil)
298303
c3 := client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).After(c2).Times(1).Return(routesInVPC, nil)
299304
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).After(c3).Times(1).Return(routesInVPC2, nil)
305+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
300306
routes, err := routeController.ListRoutes(ctx, "test")
301307
require.NoError(t, err)
302308
assert.NotEmpty(t, routes)
@@ -378,6 +384,7 @@ func TestCreateRoute(t *testing.T) {
378384

379385
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
380386
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return(noRoutesInVPC, nil)
387+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
381388
client.EXPECT().UpdateInstanceConfigInterface(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(&instanceConfigIntfWithVPCAndRoute, nil)
382389
err = routeController.CreateRoute(ctx, "dummy", "dummy", route)
383390
assert.NoError(t, err)
@@ -445,6 +452,7 @@ func TestCreateRoute(t *testing.T) {
445452

446453
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
447454
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return(routesInVPC, nil)
455+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
448456
err = routeController.CreateRoute(ctx, "dummy", "dummy", route)
449457
assert.NoError(t, err)
450458
})
@@ -459,6 +467,7 @@ func TestCreateRoute(t *testing.T) {
459467

460468
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{}, nil)
461469
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return([]linodego.VPCIP{}, nil)
470+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
462471
err = routeController.CreateRoute(ctx, "dummy", "dummy", route)
463472
assert.Error(t, err)
464473
})
@@ -502,6 +511,7 @@ func TestDeleteRoute(t *testing.T) {
502511

503512
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{}, nil)
504513
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return([]linodego.VPCIP{}, nil)
514+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
505515
err = routeController.DeleteRoute(ctx, "dummy", route)
506516
assert.Error(t, err)
507517
})
@@ -533,6 +543,7 @@ func TestDeleteRoute(t *testing.T) {
533543

534544
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
535545
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return(noRoutesInVPC, nil)
546+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
536547
client.EXPECT().UpdateInstanceConfigInterface(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(&instanceConfigIntfWithVPCAndNoRoute, nil)
537548
err = routeController.DeleteRoute(ctx, "dummy", route)
538549
assert.NoError(t, err)
@@ -565,6 +576,7 @@ func TestDeleteRoute(t *testing.T) {
565576

566577
client.EXPECT().ListInstances(gomock.Any(), nil).Times(1).Return([]linodego.Instance{validInstance}, nil)
567578
client.EXPECT().ListVPCIPAddresses(gomock.Any(), gomock.Any(), gomock.Any()).Times(2).Return(routesInVPC, nil)
579+
client.EXPECT().ListVPCIPv6Addresses(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return([]linodego.VPCIP{}, nil)
568580
client.EXPECT().UpdateInstanceConfigInterface(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(&instanceConfigIntfWithVPCAndNoRoute, nil)
569581
err = routeController.DeleteRoute(ctx, "dummy", route)
570582
assert.NoError(t, err)

0 commit comments

Comments
 (0)