Merge pull request #47505 from akerouanton/fix-TestBridgeICC-ipv6
inte/networking: ping with -6 specified when needed
This commit is contained in:
commit
0fb845858d
1 changed files with 20 additions and 6 deletions
|
@ -38,7 +38,8 @@ func TestBridgeICC(t *testing.T) {
|
|||
name string
|
||||
bridgeOpts []func(*types.NetworkCreate)
|
||||
ctr1MacAddress string
|
||||
linkLocal bool
|
||||
isIPv6 bool
|
||||
isLinkLocal bool
|
||||
pingHost string
|
||||
}{
|
||||
{
|
||||
|
@ -57,6 +58,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
network.WithIPv6(),
|
||||
network.WithIPAM("fdf1:a844:380c:b200::/64", "fdf1:a844:380c:b200::1"),
|
||||
},
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 ULA on internal network",
|
||||
|
@ -65,6 +67,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
network.WithInternal(),
|
||||
network.WithIPAM("fdf1:a844:380c:b247::/64", "fdf1:a844:380c:b247::1"),
|
||||
},
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 link-local address on non-internal network",
|
||||
|
@ -76,7 +79,8 @@ func TestBridgeICC(t *testing.T) {
|
|||
// 2. the one dynamically assigned by the IPAM driver.
|
||||
network.WithIPAM("fe80::/64", "fe80::1"),
|
||||
},
|
||||
linkLocal: true,
|
||||
isLinkLocal: true,
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 link-local address on internal network",
|
||||
|
@ -86,10 +90,11 @@ func TestBridgeICC(t *testing.T) {
|
|||
// See the note above about link-local addresses.
|
||||
network.WithIPAM("fe80::/64", "fe80::1"),
|
||||
},
|
||||
linkLocal: true,
|
||||
isLinkLocal: true,
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
// As for 'LL non-internal', but ping the container by name instead of by address
|
||||
// As for 'LL non-internal', ping the container by name instead of by address
|
||||
// - the busybox test containers only have one interface with a link local
|
||||
// address, so the zone index is not required:
|
||||
// RFC-4007, section 6: "[...] for nodes with only a single non-loopback
|
||||
|
@ -101,6 +106,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
network.WithIPv6(),
|
||||
network.WithIPAM("fe80::/64", "fe80::1"),
|
||||
},
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 nonstandard link-local subnet on non-internal network ping by name",
|
||||
|
@ -113,6 +119,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
network.WithIPv6(),
|
||||
network.WithIPAM("fe80:1234::/64", "fe80:1234::1"),
|
||||
},
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 non-internal network with SLAAC LL address",
|
||||
|
@ -124,6 +131,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
// specify one here to hardcode the SLAAC LL address below.
|
||||
ctr1MacAddress: "02:42:ac:11:00:02",
|
||||
pingHost: "fe80::42:acff:fe11:2%eth0",
|
||||
isIPv6: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 internal network with SLAAC LL address",
|
||||
|
@ -135,6 +143,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
// specify one here to hardcode the SLAAC LL address below.
|
||||
ctr1MacAddress: "02:42:ac:11:00:02",
|
||||
pingHost: "fe80::42:acff:fe11:2%eth0",
|
||||
isIPv6: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -164,7 +173,7 @@ func TestBridgeICC(t *testing.T) {
|
|||
|
||||
pingHost := tc.pingHost
|
||||
if pingHost == "" {
|
||||
if tc.linkLocal {
|
||||
if tc.isLinkLocal {
|
||||
inspect := container.Inspect(ctx, t, c, id1)
|
||||
pingHost = inspect.NetworkSettings.Networks[bridgeName].GlobalIPv6Address + "%eth0"
|
||||
} else {
|
||||
|
@ -172,7 +181,12 @@ func TestBridgeICC(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
pingCmd := []string{"ping", "-c1", "-W3", pingHost}
|
||||
ipv := "-4"
|
||||
if tc.isIPv6 {
|
||||
ipv = "-6"
|
||||
}
|
||||
|
||||
pingCmd := []string{"ping", "-c1", "-W3", ipv, pingHost}
|
||||
|
||||
ctr2Name := fmt.Sprintf("ctr-icc-%d-2", tcID)
|
||||
attachCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
|
|
Loading…
Reference in a new issue