Skip to content

Commit 0638ee5

Browse files
author
Kathryn Baldauf
committed
Fix TestLCOW_IPv6_Assignment functional test
* Previously we were just using the IPAM routes configured earlier in the test, * but this causes an error since the IPAM route will append the scope identifier * at the end of IPv6 routes' NextHop. Signed-off-by: Kathryn Baldauf <[email protected]>
1 parent 24ef284 commit 0638ee5

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

test/functional/lcow_networking_test.go

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
3838
})
3939
t.Logf("created namespace %s", ns.Id)
4040

41+
ipv4Route := hcn.Route{
42+
NextHop: "192.168.128.1",
43+
DestinationPrefix: "0.0.0.0/0",
44+
}
45+
46+
ipv6Route := hcn.Route{
47+
NextHop: "fd00::101",
48+
DestinationPrefix: "::/0",
49+
}
50+
4151
// create network and endpoint
4252
ntwk, err := (&hcn.HostComputeNetwork{
4353
Name: hcsOwner + "network",
@@ -48,21 +58,11 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
4858
Subnets: []hcn.Subnet{
4959
{
5060
IpAddressPrefix: "192.168.128.0/20",
51-
Routes: []hcn.Route{
52-
{
53-
NextHop: "192.168.128.1",
54-
DestinationPrefix: "0.0.0.0/0",
55-
},
56-
},
61+
Routes: []hcn.Route{ipv4Route},
5762
},
5863
{
5964
IpAddressPrefix: "fd00::100/120",
60-
Routes: []hcn.Route{
61-
{
62-
NextHop: "fd00::101",
63-
DestinationPrefix: "::/0",
64-
},
65-
},
65+
Routes: []hcn.Route{ipv6Route},
6666
},
6767
},
6868
},
@@ -88,17 +88,10 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
8888
PrefixLength: 120,
8989
}
9090

91-
rts := []hcn.Route{}
92-
for _, ipam := range ntwk.Ipams {
93-
for _, sb := range ipam.Subnets {
94-
rts = append(rts, sb.Routes...)
95-
t.Logf("%s subnet %s (gw: %s)", ipam.Type, sb.IpAddressPrefix, sb.Routes[0].NextHop)
96-
}
97-
}
9891
ep, err := (&hcn.HostComputeEndpoint{
9992
Name: ntwk.Name + "endpoint",
10093
HostComputeNetwork: ntwk.Id,
101-
Routes: rts,
94+
Routes: []hcn.Route{ipv4Route, ipv6Route},
10295
IpConfigurations: []hcn.IpConfig{ip4Want, ip6Want},
10396
SchemaVersion: hcn.Version{Major: 2, Minor: 2},
10497
}).Create()

0 commit comments

Comments
 (0)