Skip to content

Commit 39ae06b

Browse files
committed
fix e2e
Signed-off-by: Wenqi Qiu <wenqi.qiu@broadcom.com>
1 parent 9f20872 commit 39ae06b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

test/e2e/nsx_subnet_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1"
2222
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/services/common"
23+
"github.com/vmware-tanzu/nsx-operator/pkg/util"
2324
)
2425

2526
const (
@@ -55,10 +56,14 @@ func verifySubnetSetCR(subnetSet string) bool {
5556
log.Error(nil, "IPv4SubnetSize mismatch", "IPv4SubnetSize", subnetSetCR.Spec.IPv4SubnetSize, "expected", vpcNetworkConfig.Spec.DefaultSubnetSize)
5657
return false
5758
}
58-
wantIPv6 := vpcNetworkConfig.Spec.DefaultIPv6PrefixLength
59-
if subnetSetCR.Spec.IPv6PrefixLength != wantIPv6 {
60-
log.Error(nil, "IPv6PrefixLength mismatch", "IPv6PrefixLength", subnetSetCR.Spec.IPv6PrefixLength, "expected", wantIPv6)
61-
return false
59+
// IPv6PrefixLength is only set on SubnetSets for IPv6 or dual-stack clusters.
60+
// Skip this check when the SubnetSet IP address type is IPv4-only (or unset).
61+
if util.IPv6PrefixLengthApplicable(subnetSetCR.Spec.IPAddressType) {
62+
wantIPv6 := vpcNetworkConfig.Spec.DefaultIPv6PrefixLength
63+
if subnetSetCR.Spec.IPv6PrefixLength != wantIPv6 {
64+
log.Error(nil, "IPv6PrefixLength mismatch", "IPv6PrefixLength", subnetSetCR.Spec.IPv6PrefixLength, "expected", wantIPv6)
65+
return false
66+
}
6267
}
6368
return true
6469
}

0 commit comments

Comments
 (0)