@@ -41,18 +41,19 @@ func failIfNodeNotInMachineNetwork(nodes corev1.NodeList, machineNetworks []stri
41
41
42
42
func failIfIncorrectPortgroupsAttachedToVMs (
43
43
ctx context.Context ,
44
- infra configv1.PlatformSpec ,
44
+ infra * configv1.Infrastructure ,
45
45
nodeList * corev1.NodeList ,
46
46
vsphereCreds * corev1.Secret ) {
47
47
48
48
By ("checking if VMs have the correct portgroups attached" )
49
49
50
- for _ , failureDomain := range infra .VSphere .FailureDomains {
51
- nodes , err := getNodesInFailureDomain (infra .VSphere , failureDomain , nodeList )
50
+ providerSpec := infra .Spec .PlatformSpec
51
+ for _ , failureDomain := range providerSpec .VSphere .FailureDomains {
52
+ nodes , err := getNodesInFailureDomain (providerSpec .VSphere , failureDomain , nodeList )
52
53
fmt .Printf ("nodes: %d" , len (nodes ))
53
54
Expect (err ).NotTo (HaveOccurred ())
54
55
55
- vmPortgroupMap , err := GetPortGroupsAttachedToVMsInFailureDomain (ctx , failureDomain , vsphereCreds , infra .VSphere .VCenters )
56
+ vmPortgroupMap , err := GetPortGroupsAttachedToVMsInFailureDomain (ctx , infra . Status . InfrastructureName , failureDomain , vsphereCreds , providerSpec .VSphere .VCenters )
56
57
if err != nil {
57
58
Expect (err ).NotTo (HaveOccurred ())
58
59
}
@@ -82,13 +83,21 @@ func failIfIncorrectPortgroupsAttachedToVMs(
82
83
}
83
84
84
85
func failIfNodeNetworkingInconsistentWithMachineNetwork (infra configv1.PlatformSpec , machineNetworks []string ) {
86
+ // This can happen in scenarios where multinetwork is not enabled.
87
+ if len (infra .VSphere .NodeNetworking .External .NetworkSubnetCIDR ) == 0 ||
88
+ len (infra .VSphere .NodeNetworking .Internal .NetworkSubnetCIDR ) == 0 {
89
+ Skip ("skipping test due to incomplete config" )
90
+ }
91
+
85
92
internalNodeNetworking := infra .VSphere .NodeNetworking .Internal
86
93
externalNodeNetworking := infra .VSphere .NodeNetworking .External
87
94
95
+ // machineNetworks contain the VIPs now so we'll need to check each network to see if we find one that matches internal/external.
88
96
By ("comparing nodeNetworking slices to the machine network" )
89
97
for _ , nodeNetworkingSpec := range []configv1.VSpherePlatformNodeNetworkingSpec {internalNodeNetworking , externalNodeNetworking } {
90
- slices .Sort (nodeNetworkingSpec .NetworkSubnetCIDR )
91
- Expect (slices .Equal (nodeNetworkingSpec .NetworkSubnetCIDR , machineNetworks )).To (BeTrue ())
98
+ for _ , network := range nodeNetworkingSpec .NetworkSubnetCIDR {
99
+ Expect (slices .Contains (machineNetworks , network )).To (BeTrue ())
100
+ }
92
101
}
93
102
}
94
103
@@ -126,7 +135,7 @@ func failIfMachineDoesNotHaveAllPortgroups(machine machinev1beta1.Machine, failu
126
135
Expect (slices .Equal (expectedPortgroups , portgroups )).To (BeTrue ())
127
136
}
128
137
129
- var _ = Describe ("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][platform:vsphere] Managed cluster should" , func () {
138
+ var _ = Describe ("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][platform:vsphere] Managed cluster should" , Label ( "Conformance" ), func () {
130
139
defer GinkgoRecover ()
131
140
ctx := context .Background ()
132
141
@@ -190,24 +199,24 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
190
199
}
191
200
})
192
201
193
- It ("node addresses should be correlated with the machine network" , func () {
202
+ It ("node addresses should be correlated with the machine network [apigroup:machine.openshift.io][Suite:openshift/conformance/parallel] " , func () {
194
203
By ("checking for correlation between node internal/external IPs and the machine network" )
195
204
failIfNodeNotInMachineNetwork (* nodes , machineNetworks )
196
205
})
197
206
198
- It ("machine network should be correlated with node networking" , func () {
207
+ It ("machine network should be correlated with node networking [apigroup:machine.openshift.io][Suite:openshift/conformance/parallel] " , func () {
199
208
failIfNodeNetworkingInconsistentWithMachineNetwork (infra .Spec .PlatformSpec , machineNetworks )
200
209
})
201
210
202
- It ("machines should have all specified portgroup associated with their failure domain" , func () {
211
+ It ("machines should have all specified portgroup associated with their failure domain [apigroup:machine.openshift.io][Suite:openshift/conformance/parallel] " , func () {
203
212
failIfMachinesDoNotHaveAllPortgroups (infra .Spec .PlatformSpec , machines )
204
213
})
205
214
206
- It ("node VMs should have all specified portgroups attached which are associated with their failure domain" , func () {
207
- failIfIncorrectPortgroupsAttachedToVMs (ctx , infra . Spec . PlatformSpec , nodes , vsphereCreds )
215
+ It ("node VMs should have all specified portgroups attached which are associated with their failure domain [apigroup:machine.openshift.io][Suite:openshift/conformance/parallel] " , func () {
216
+ failIfIncorrectPortgroupsAttachedToVMs (ctx , infra , nodes , vsphereCreds )
208
217
})
209
218
210
- It ("new machines should pass multi network tests" , func () {
219
+ It ("new machines should pass multi network tests [apigroup:machine.openshift.io][Suite:openshift/conformance/serial]" , Label ( "Serial" ) , func () {
211
220
machineSets , err := e2eutil .GetMachineSets (cfg )
212
221
Expect (err ).NotTo (HaveOccurred ())
213
222
@@ -244,6 +253,6 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
244
253
failIfNodeNotInMachineNetwork (* nodes , machineNetworks )
245
254
failIfNodeNetworkingInconsistentWithMachineNetwork (infra .Spec .PlatformSpec , machineNetworks )
246
255
failIfMachinesDoNotHaveAllPortgroups (infra .Spec .PlatformSpec , machines )
247
- failIfIncorrectPortgroupsAttachedToVMs (ctx , infra . Spec . PlatformSpec , nodes , vsphereCreds )
256
+ failIfIncorrectPortgroupsAttachedToVMs (ctx , infra , nodes , vsphereCreds )
248
257
})
249
258
})
0 commit comments