Skip to content

Commit

Permalink
Fix TestLCOW_IPv6_Assignment functional test
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
katiewasnothere authored and jiechen0826 committed Jan 22, 2025
1 parent 1320a30 commit 41c33bb
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions test/functional/lcow_networking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
})
t.Logf("created namespace %s", ns.Id)

ipv4Route := hcn.Route{
NextHop: "192.168.128.1",
DestinationPrefix: "0.0.0.0/0",
}

ipv6Route := hcn.Route{
NextHop: "fd00::101",
DestinationPrefix: "::/0",
}

// create network and endpoint
ntwk, err := (&hcn.HostComputeNetwork{
Name: hcsOwner + "network",
Expand All @@ -48,21 +58,11 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
Subnets: []hcn.Subnet{
{
IpAddressPrefix: "192.168.128.0/20",
Routes: []hcn.Route{
{
NextHop: "192.168.128.1",
DestinationPrefix: "0.0.0.0/0",
},
},
Routes: []hcn.Route{ipv4Route},
},
{
IpAddressPrefix: "fd00::100/120",
Routes: []hcn.Route{
{
NextHop: "fd00::101",
DestinationPrefix: "::/0",
},
},
Routes: []hcn.Route{ipv6Route},
},
},
},
Expand All @@ -88,17 +88,10 @@ func TestLCOW_IPv6_Assignment(t *testing.T) {
PrefixLength: 120,
}

rts := []hcn.Route{}
for _, ipam := range ntwk.Ipams {
for _, sb := range ipam.Subnets {
rts = append(rts, sb.Routes...)
t.Logf("%s subnet %s (gw: %s)", ipam.Type, sb.IpAddressPrefix, sb.Routes[0].NextHop)
}
}
ep, err := (&hcn.HostComputeEndpoint{
Name: ntwk.Name + "endpoint",
HostComputeNetwork: ntwk.Id,
Routes: rts,
Routes: []hcn.Route{ipv4Route, ipv6Route},
IpConfigurations: []hcn.IpConfig{ip4Want, ip6Want},
SchemaVersion: hcn.Version{Major: 2, Minor: 2},
}).Create()
Expand Down

0 comments on commit 41c33bb

Please sign in to comment.