kube-proxy: don't use invalid cidrs in unit test
CIDRs like 192.168.200.3/24 and fd00:20::1/64 replaced with 192.168.200.0/24 and fd00:20::/64
This commit is contained in:
@@ -372,58 +372,58 @@ func TestMapCIDRsByIPFamily(t *testing.T) {
|
||||
},
|
||||
{
|
||||
desc: "want IPv4 and receive IPv6",
|
||||
ipString: []string{"fd00:20::1/64"},
|
||||
ipString: []string{"fd00:20::/64"},
|
||||
wantIPv6: false,
|
||||
expectCorrect: nil,
|
||||
expectIncorrect: []string{"fd00:20::1/64"},
|
||||
expectIncorrect: []string{"fd00:20::/64"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv6 and receive IPv4",
|
||||
ipString: []string{"192.168.200.2/24"},
|
||||
ipString: []string{"192.168.200.0/24"},
|
||||
wantIPv6: true,
|
||||
expectCorrect: nil,
|
||||
expectIncorrect: []string{"192.168.200.2/24"},
|
||||
expectIncorrect: []string{"192.168.200.0/24"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv6 and receive IPv4 and IPv6",
|
||||
ipString: []string{"192.168.200.2/24", "192.1.34.23/24", "fd00:20::1/64", "2001:db9::3/64"},
|
||||
ipString: []string{"192.168.200.0/24", "192.1.34.0/24", "fd00:20::/64", "2001:db9::/64"},
|
||||
wantIPv6: true,
|
||||
expectCorrect: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
expectIncorrect: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
expectCorrect: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
expectIncorrect: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv4 and receive IPv4 and IPv6",
|
||||
ipString: []string{"192.168.200.2/24", "192.1.34.23/24", "fd00:20::1/64", "2001:db9::3/64"},
|
||||
ipString: []string{"192.168.200.0/24", "192.1.34.0/24", "fd00:20::/64", "2001:db9::/64"},
|
||||
wantIPv6: false,
|
||||
expectCorrect: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
expectIncorrect: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
expectCorrect: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
expectIncorrect: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv4 and receive IPv4 only",
|
||||
ipString: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
ipString: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
wantIPv6: false,
|
||||
expectCorrect: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
expectCorrect: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
expectIncorrect: nil,
|
||||
},
|
||||
{
|
||||
desc: "want IPv6 and receive IPv4 only",
|
||||
ipString: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
ipString: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
wantIPv6: true,
|
||||
expectCorrect: nil,
|
||||
expectIncorrect: []string{"192.168.200.2/24", "192.1.34.23/24"},
|
||||
expectIncorrect: []string{"192.168.200.0/24", "192.1.34.0/24"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv4 and receive IPv6 only",
|
||||
ipString: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
ipString: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
wantIPv6: false,
|
||||
expectCorrect: nil,
|
||||
expectIncorrect: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
expectIncorrect: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
},
|
||||
{
|
||||
desc: "want IPv6 and receive IPv6 only",
|
||||
ipString: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
ipString: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
wantIPv6: true,
|
||||
expectCorrect: []string{"fd00:20::1/64", "2001:db9::3/64"},
|
||||
expectCorrect: []string{"fd00:20::/64", "2001:db9::/64"},
|
||||
expectIncorrect: nil,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user