@@ -958,31 +958,41 @@ func TestEgressCIDRAllocation(t *testing.T) {
958
958
t .Fatalf ("%v" , err )
959
959
}
960
960
961
- // Changing the EgressIPs of a namespace should drop the old allocation and create a new one
961
+ // Changing/Removing the EgressIPs of a namespace should drop the old allocation and create a new one
962
962
updateNetNamespaceEgress (eit , & networkapi.NetNamespace {
963
963
NetID : 46 ,
964
964
EgressIPs : []string {"172.17.0.202" }, // was 172.17.0.200
965
965
})
966
+ updateNetNamespaceEgress (eit , & networkapi.NetNamespace {
967
+ NetID : 44 ,
968
+ EgressIPs : []string {}, // was 172.17.1.1
969
+ })
966
970
err = w .assertChanges (
967
971
"release 172.17.0.200 on 172.17.0.4" ,
968
972
"namespace 46 dropped" ,
969
973
"update egress CIDRs" ,
974
+ "release 172.17.1.1 on 172.17.0.3" ,
975
+ "namespace 44 normal" ,
976
+ "update egress CIDRs" ,
970
977
)
971
978
if err != nil {
972
979
t .Fatalf ("%v" , err )
973
980
}
974
981
975
982
allocation = eit .ReallocateEgressIPs ()
976
- for _ , ip := range allocation ["node-4" ] {
977
- if ip == "172.17.0.200" {
978
- t .Fatalf ("reallocation failed to drop unused egress IP 172.17.0.200: %#v" , allocation )
983
+ for _ , nodeAllocation := range allocation {
984
+ for _ , ip := range nodeAllocation {
985
+ if ip == "172.17.1.1" || ip == "172.17.0.200" {
986
+ t .Fatalf ("reallocation failed to drop unused egress IP %s: %#v" , ip , allocation )
987
+ }
979
988
}
980
989
}
981
990
updateAllocations (eit , allocation )
982
991
err = w .assertChanges (
983
992
"claim 172.17.0.202 on 172.17.0.4 for namespace 46" ,
984
993
"namespace 46 via 172.17.0.202 on 172.17.0.4" ,
985
994
"update egress CIDRs" ,
995
+ "update egress CIDRs" ,
986
996
)
987
997
if err != nil {
988
998
t .Fatalf ("%v" , err )
0 commit comments