Skip to content

Commit 88dbfba

Browse files
Merge pull request #20849 from danwinship/fix-test-egress-cidr-allocation
Fix up logic in TestEgressCIDRAllocationOffline
2 parents 3f5a604 + e49bfc9 commit 88dbfba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/network/common/egressip_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,18 @@ func TestEgressCIDRAllocationOffline(t *testing.T) {
11711171
t.Fatalf("%v", err)
11721172
}
11731173

1174-
// Next reallocation should reassign egress IPs to node-3
1174+
// Next reallocation should reassign the IPs that were removed in the previous
1175+
// round. While the last reallocation was designed to aim for a next reallocation
1176+
// where all of the removed IPs end up on node-3, it's possible 1 of them will
1177+
// end up getting reallocated back to the same node it was removed from.
11751178
allocation = eit.ReallocateEgressIPs()
11761179
node3ips = allocation["node-3"]
11771180
node4ips = allocation["node-4"]
11781181
node5ips = allocation["node-5"]
1179-
if len(node3ips) < 2 || len(node4ips) == 0 || len(node5ips) == 0 {
1182+
if len(node3ips) < 1 || len(node3ips) > 3 ||
1183+
len(node4ips) < 1 || len(node4ips) > 3 ||
1184+
len(node5ips) < 1 || len(node5ips) > 3 ||
1185+
len(node3ips)+len(node4ips)+len(node5ips) != 6 {
11801186
t.Fatalf("Bad IP allocation: %#v", allocation)
11811187
}
11821188
updateAllocations(eit, allocation)

0 commit comments

Comments
 (0)