Skip to content

Commit 90f1bfd

Browse files
Merge pull request #1379 from vr4manta/SPLAT-2039
SPLAT-2039: Fixed test logic for hybrid env scenario
2 parents 37689e5 + 156e352 commit 90f1bfd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/e2e/vsphere/multi-nic.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ func failIfNodeNotInMachineNetwork(nodes corev1.NodeList, machineNetworks []stri
3232
if address.Type != "InternalIP" && address.Type != "ExternalIP" {
3333
continue
3434
}
35-
inRange, err := isIpInCidrRange(address.Address, machineNetworks[0])
36-
Expect(err).NotTo(HaveOccurred())
37-
Expect(inRange).To(BeTrue())
35+
36+
cidrFound := false
37+
for _, machineNetwork := range machineNetworks {
38+
inRange, err := isIpInCidrRange(address.Address, machineNetwork)
39+
Expect(err).NotTo(HaveOccurred())
40+
41+
if inRange {
42+
cidrFound = true
43+
break
44+
}
45+
}
46+
47+
Expect(cidrFound).To(BeTrue(), "machine IP must be in one of the machine network CIDR ranges")
3848
}
3949
}
4050
}
@@ -61,8 +71,11 @@ func failIfIncorrectPortgroupsAttachedToVMs(
6171
var nodeProviderIds []string
6272
for _, node := range nodes {
6373
providerId := node.Spec.ProviderID
64-
Expect(len(providerId)).ShouldNot(BeZero())
6574

75+
if !strings.HasPrefix(providerId, "vsphere://") {
76+
// Node is not a vsphere node. This could be a BM node in a hybrid scenario or maybe even a nutanix node.
77+
continue
78+
}
6679
parts := strings.Split(providerId, "vsphere://")
6780
Expect(len(parts)).Should(BeIdenticalTo(2))
6881

0 commit comments

Comments
 (0)