|
61 | 61 | },
|
62 | 62 | }
|
63 | 63 | expectedTags = []*elb.Tag{
|
| 64 | + { |
| 65 | + Key: aws.String("Name"), |
| 66 | + Value: lbName, |
| 67 | + }, |
64 | 68 | {
|
65 | 69 | Key: aws.String("sigs.k8s.io/cluster-api-provider-aws/cluster/test-cluster"),
|
66 | 70 | Value: aws.String("owned"),
|
|
69 | 73 | Key: aws.String("sigs.k8s.io/cluster-api-provider-aws/role"),
|
70 | 74 | Value: aws.String("apiserver"),
|
71 | 75 | },
|
72 |
| - { |
73 |
| - Key: aws.String("Name"), |
74 |
| - Value: lbName, |
75 |
| - }, |
76 | 76 | }
|
77 | 77 | )
|
78 | 78 |
|
@@ -162,23 +162,19 @@ func mockedCreateLBCalls(t *testing.T, m *mock_elbiface.MockELBAPIMockRecorder)
|
162 | 162 | LoadBalancerName: aws.String(""),
|
163 | 163 | })).MaxTimes(1)
|
164 | 164 |
|
165 |
| - m.AddTags(gomock.Eq(&elb.AddTagsInput{ |
166 |
| - LoadBalancerNames: aws.StringSlice([]string{""}), |
167 |
| - Tags: expectedTags, |
168 |
| - })).Do(func(actual *elb.AddTagsInput) (*elb.AddTagsOutput, error) { |
169 |
| - sortTagsByKey := func(tags []*elb.Tag) { |
170 |
| - sort.Slice(tags, func(i, j int) bool { |
171 |
| - return *(tags[i].Key) < *(tags[j].Key) |
172 |
| - }) |
173 |
| - } |
| 165 | + m.AddTags(gomock.AssignableToTypeOf(&elb.AddTagsInput{})).Return(&elb.AddTagsOutput{}, nil).Do( |
| 166 | + func(actual *elb.AddTagsInput) { |
| 167 | + sortTagsByKey := func(tags []*elb.Tag) { |
| 168 | + sort.Slice(tags, func(i, j int) bool { |
| 169 | + return *(tags[i].Key) < *(tags[j].Key) |
| 170 | + }) |
| 171 | + } |
174 | 172 |
|
175 |
| - sortTagsByKey(actual.Tags) |
176 |
| - sortTagsByKey(expectedTags) |
177 |
| - if !reflect.DeepEqual(expectedTags, actual.Tags) { |
178 |
| - t.Fatalf("Actual AddTagsInput did not match expected, Actual : %v, Expected: %v", actual.Tags, expectedTags) |
179 |
| - } |
180 |
| - return &elb.AddTagsOutput{}, nil |
181 |
| - }).AnyTimes() |
| 173 | + sortTagsByKey(actual.Tags) |
| 174 | + if !reflect.DeepEqual(expectedTags, actual.Tags) { |
| 175 | + t.Fatalf("Actual AddTagsInput did not match expected, Actual : %v, Expected: %v", actual.Tags, expectedTags) |
| 176 | + } |
| 177 | + }).AnyTimes() |
182 | 178 | m.RemoveTags(gomock.Eq(&elb.RemoveTagsInput{
|
183 | 179 | LoadBalancerNames: aws.StringSlice([]string{""}),
|
184 | 180 | Tags: []*elb.TagKeyOnly{
|
|
0 commit comments