Skip to content

Commit 8da84ff

Browse files
committed
Use documentation IPv6 addresses (RFC 3849) in tests
Signed-off-by: Tim Düsterhus <tim@bastelstu.be>
1 parent 29c413a commit 8da84ff

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

driverapi/driverapi_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestValidateAndIsV6(t *testing.T) {
6969
t.Fatalf("incorrect ip version returned")
7070
}
7171
orig := i.Pool
72-
if i.Pool, err = types.ParseCIDR("2003::33/64"); err != nil {
72+
if i.Pool, err = types.ParseCIDR("2001:db8::33/64"); err != nil {
7373
t.Fatal(err)
7474
}
7575
if !i.IsV6() {
@@ -83,7 +83,7 @@ func TestValidateAndIsV6(t *testing.T) {
8383
}
8484

8585
// incongruent gw ver
86-
if i.Gateway, err = types.ParseCIDR("2001::45/65"); err != nil {
86+
if i.Gateway, err = types.ParseCIDR("2001:db8::45/65"); err != nil {
8787
t.Fatal(err)
8888
}
8989
if err = i.Validate(); err == nil {
@@ -92,7 +92,7 @@ func TestValidateAndIsV6(t *testing.T) {
9292
i.Gateway = nil
9393

9494
// incongruent secondary ip ver
95-
if i.AuxAddresses["ip2"], err = types.ParseCIDR("2002::44/80"); err != nil {
95+
if i.AuxAddresses["ip2"], err = types.ParseCIDR("2001:db8::44/80"); err != nil {
9696
t.Fatal(err)
9797
}
9898
if err = i.Validate(); err == nil {

drivers/bridge/bridge_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func TestCreateFullOptionsLabels(t *testing.T) {
112112
}
113113

114114
bndIPs := "127.0.0.1"
115-
nwV6s := "2100:2400:2600:2700:2800::/80"
116-
gwV6s := "2100:2400:2600:2700:2800::25/80"
115+
nwV6s := "2001:db8:2600:2700:2800::/80"
116+
gwV6s := "2001:db8:2600:2700:2800::25/80"
117117
nwV6, _ := types.ParseCIDR(nwV6s)
118118
gwV6, _ := types.ParseCIDR(gwV6s)
119119

@@ -191,7 +191,7 @@ func TestCreateFullOptionsLabels(t *testing.T) {
191191
if !nwV6.Contains(te.Interface().AddressIPv6().IP) {
192192
t.Fatalf("endpoint got assigned address outside of container network(%s): %s", nwV6.String(), te.Interface().AddressIPv6())
193193
}
194-
if te.Interface().AddressIPv6().IP.String() != "2100:2400:2600:2700:2800:aabb:ccdd:eeff" {
194+
if te.Interface().AddressIPv6().IP.String() != "2001:db8:2600:2700:2800:aabb:ccdd:eeff" {
195195
t.Fatalf("Unexpected endpoint IPv6 address: %v", te.Interface().AddressIPv6().IP)
196196
}
197197
}
@@ -724,18 +724,18 @@ func TestValidateConfig(t *testing.T) {
724724
}
725725

726726
// Test v6 gw
727-
_, v6nw, _ := net.ParseCIDR("2001:1234:ae:b004::/64")
727+
_, v6nw, _ := net.ParseCIDR("2001:db8:ae:b004::/64")
728728
c = networkConfiguration{
729729
EnableIPv6: true,
730730
AddressIPv6: v6nw,
731-
DefaultGatewayIPv6: net.ParseIP("2001:1234:ac:b004::bad:a55"),
731+
DefaultGatewayIPv6: net.ParseIP("2001:db8:ac:b004::bad:a55"),
732732
}
733733
err = c.Validate()
734734
if err == nil {
735735
t.Fatalf("Failed to detect invalid v6 default gateway")
736736
}
737737

738-
c.DefaultGatewayIPv6 = net.ParseIP("2001:1234:ae:b004::bad:a55")
738+
c.DefaultGatewayIPv6 = net.ParseIP("2001:db8:ae:b004::bad:a55")
739739
err = c.Validate()
740740
if err != nil {
741741
t.Fatalf("Unexpected validation error on v6 default gateway")

ipam/allocator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func TestGetAddressVersion(t *testing.T) {
8686
if v6 != getAddressVersion(net.ParseIP("ff01::1")) {
8787
t.Fatalf("Failed to detect IPv6 version")
8888
}
89-
if v6 != getAddressVersion(net.ParseIP("2001:56::76:51")) {
89+
if v6 != getAddressVersion(net.ParseIP("2001:db8::76:51")) {
9090
t.Fatalf("Failed to detect IPv6 version")
9191
}
9292
}
@@ -523,11 +523,11 @@ func TestRemoveSubnet(t *testing.T) {
523523
{localAddressSpace, "192.168.0.0/16", false},
524524
{localAddressSpace, "172.17.0.0/16", false},
525525
{localAddressSpace, "10.0.0.0/8", false},
526-
{localAddressSpace, "2002:1:2:3:4:5:ffff::/112", false},
526+
{localAddressSpace, "2001:db8:1:2:3:4:ffff::/112", false},
527527
{"splane", "172.17.0.0/16", false},
528528
{"splane", "10.0.0.0/8", false},
529-
{"splane", "2002:1:2:3:4:5:6::/112", true},
530-
{"splane", "2002:1:2:3:4:5:ffff::/112", true},
529+
{"splane", "2001:db8:1:2:3:4:5::/112", true},
530+
{"splane", "2001:db8:1:2:3:4:ffff::/112", true},
531531
}
532532

533533
poolIDs := make([]string, len(input))

libnetwork_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func printIpamInfo(list []*IpamInfo) string {
179179
}
180180

181181
func TestEndpointMarshalling(t *testing.T) {
182-
ip, nw6, err := net.ParseCIDR("2001:3002:4003::122/64")
182+
ip, nw6, err := net.ParseCIDR("2001:db8:4003::122/64")
183183
if err != nil {
184184
t.Fatal(err)
185185
}

types/types_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ func TestCompareIPMask(t *testing.T) {
180180
ms: 0,
181181
},
182182
{ // ip and mask as v6
183-
ip: net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"),
183+
ip: net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"),
184184
mask: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0, 0},
185185
is: 0,
186186
ms: 0,
187187
},
188188
{
189-
ip: net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"),
189+
ip: net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"),
190190
mask: []byte{0xff, 0xff, 0xff, 0},
191191
isErr: true,
192192
},
@@ -244,7 +244,7 @@ func TestUtilGetHostPortionIP(t *testing.T) {
244244
host: net.IPv4(0, 0, 0, 4)[12:],
245245
},
246246
{ // ip and mask as v6
247-
ip: net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"),
247+
ip: net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"),
248248
mask: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0, 0},
249249
host: net.ParseIP("0::AB:00CD"),
250250
},
@@ -261,7 +261,7 @@ func TestUtilGetHostPortionIP(t *testing.T) {
261261
}
262262

263263
// ip as v6 and mask as v4 are not compatible
264-
if _, err := GetHostPartIP(net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"), []byte{0xff, 0xff, 0xff, 0}); err == nil {
264+
if _, err := GetHostPartIP(net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"), []byte{0xff, 0xff, 0xff, 0}); err == nil {
265265
t.Fatalf("Unexpected success")
266266
}
267267
// ip as v4 and non conventional mask
@@ -326,9 +326,9 @@ func TestUtilGetBroadcastIP(t *testing.T) {
326326
bcast: net.IPv4(172, 28, 255, 255)[12:],
327327
},
328328
{ // ip and mask as v6
329-
ip: net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"),
329+
ip: net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"),
330330
mask: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0, 0},
331-
bcast: net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEFF:FFFF"),
331+
bcast: net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEFF:FFFF"),
332332
},
333333
}
334334

@@ -343,7 +343,7 @@ func TestUtilGetBroadcastIP(t *testing.T) {
343343
}
344344

345345
// ip as v6 and mask as v4 are not compatible
346-
if _, err := GetBroadcastIP(net.ParseIP("2005:2004:2002:2001:FFFF:ABCD:EEAB:00CD"), []byte{0xff, 0xff, 0xff, 0}); err == nil {
346+
if _, err := GetBroadcastIP(net.ParseIP("2001:DB8:2002:2001:FFFF:ABCD:EEAB:00CD"), []byte{0xff, 0xff, 0xff, 0}); err == nil {
347347
t.Fatalf("Unexpected success")
348348
}
349349
// ip as v4 and non conventional mask

0 commit comments

Comments
 (0)