Skip to content

Commit

Permalink
Merge pull request moby#47505 from akerouanton/fix-TestBridgeICC-ipv6
Browse files Browse the repository at this point in the history
inte/networking:  ping with -6 specified when needed
  • Loading branch information
thaJeztah authored Mar 8, 2024
2 parents db22637 + 5a009cd commit 0fb8458
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions integration/networking/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}{
{
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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,
},
}

Expand Down Expand Up @@ -164,15 +173,20 @@ 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 {
pingHost = ctr1Name
}
}

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)
Expand Down

0 comments on commit 0fb8458

Please sign in to comment.