Skip to content

Commit

Permalink
deflake unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
freehan committed Aug 27, 2018
1 parent 4232da1 commit 529cc79
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/controller/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,17 @@ func TestGetNodePortsUsedByIngress(t *testing.T) {

for _, tc := range testCases {
res := nodePorts(tc.svcPorts)
if !reflect.DeepEqual(res, tc.expectPorts) {
t.Errorf("For case %q, expect %v, but got %v", tc.desc, tc.expectPorts, res)
for _, p := range res {
found := false
for _, ep := range tc.expectPorts {
if reflect.DeepEqual(ep, p) {
found = true
}
}
if !found {
t.Errorf("For case %q, expect %v, but got %v", tc.desc, tc.expectPorts, res)
break
}
}
}

Expand Down

0 comments on commit 529cc79

Please sign in to comment.