Skip to content

Commit 52f4bf3

Browse files
committed
SPLAT-2051: introduce e2e tests for multi network vsphere
1 parent 7c01dd7 commit 52f4bf3

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Diff for: test/e2e/vsphere/multi-nic.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import (
2424
)
2525

2626
func failIfNodeNotInMachineNetwork(nodes corev1.NodeList, machineNetworks []string) {
27+
28+
By("checking if nodes are in the machine network")
29+
2730
for _, node := range nodes.Items {
2831
for _, address := range node.Status.Addresses {
2932
if address.Type != "InternalIP" && address.Type != "ExternalIP" {
@@ -41,6 +44,9 @@ func failIfIncorrectPortgroupsAttachedToVMs(
4144
infra configv1.PlatformSpec,
4245
nodeList *corev1.NodeList,
4346
vsphereCreds *corev1.Secret) {
47+
48+
By("checking if VMs have the correct portgroups attached")
49+
4450
for _, failureDomain := range infra.VSphere.FailureDomains {
4551
nodes, err := getNodesInFailureDomain(infra.VSphere, failureDomain, nodeList)
4652
fmt.Printf("nodes: %d", len(nodes))
@@ -87,6 +93,9 @@ func failIfNodeNetworkingInconsistentWithMachineNetwork(infra configv1.PlatformS
8793
}
8894

8995
func failIfMachinesDoNotHaveAllPortgroups(platformSpec configv1.PlatformSpec, machines *machinev1beta1.MachineList) {
96+
97+
By("checking to see if machines have all portgroups")
98+
9099
for _, failureDomain := range platformSpec.VSphere.FailureDomains {
91100
machinesInFailureDomain, err := getMachinesInFailureDomain(platformSpec.VSphere, failureDomain, machines)
92101
Expect(err).NotTo(HaveOccurred())
@@ -98,6 +107,9 @@ func failIfMachinesDoNotHaveAllPortgroups(platformSpec configv1.PlatformSpec, ma
98107
}
99108

100109
func failIfMachineDoesNotHaveAllPortgroups(machine machinev1beta1.Machine, failureDomain configv1.VSpherePlatformFailureDomainSpec) {
110+
111+
By("checking to see if machine has all portgroups")
112+
101113
spec, err := vsphere.ProviderSpecFromRawExtension(machine.Spec.ProviderSpec.Value)
102114
Expect(err).NotTo(HaveOccurred())
103115

@@ -204,6 +216,7 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
204216
machineSet := machineSets.Items[0]
205217

206218
// scale up new machine and wait for scale up to complete
219+
By("scaling up a new machineset which should have multiple NICs")
207220
err = e2eutil.ScaleMachineSet(cfg, machineSet.Name, int(*machineSet.Spec.Replicas)+1)
208221
Expect(err).NotTo(HaveOccurred())
209222

@@ -213,6 +226,7 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
213226
machines, err = mc.Machines("openshift-machine-api").List(ctx, v1.ListOptions{})
214227
Expect(err).NotTo(HaveOccurred())
215228

229+
By("determining common port groups among machines")
216230
portGroups := make(map[string]any)
217231
for _, machine := range machines.Items {
218232
providerSpec, err := vsphere.ProviderSpecFromRawExtension(machine.Spec.ProviderSpec.Value)
@@ -232,5 +246,4 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
232246
failIfMachinesDoNotHaveAllPortgroups(infra.Spec.PlatformSpec, machines)
233247
failIfIncorrectPortgroupsAttachedToVMs(ctx, infra.Spec.PlatformSpec, nodes, vsphereCreds)
234248
})
235-
236249
})

Diff for: test/e2e/vsphere/util.go

+11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99
"strconv"
1010
"time"
1111

12+
. "github.com/onsi/ginkgo/v2"
1213
. "github.com/onsi/gomega"
14+
1315
configv1 "github.com/openshift/api/config/v1"
1416
"github.com/openshift/api/machine/v1beta1"
1517
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
@@ -45,6 +47,9 @@ func getNodesInFailureDomain(vsphereInfraSpec *configv1.VSpherePlatformSpec,
4547
if len(vsphereInfraSpec.FailureDomains) < 2 {
4648
return nodes.Items, nil
4749
}
50+
51+
By("getting nodes in failure domain")
52+
4853
var nodesInFd []corev1.Node
4954
region := fd.Region
5055
zone := fd.Zone
@@ -75,6 +80,9 @@ func getNodesInFailureDomain(vsphereInfraSpec *configv1.VSpherePlatformSpec,
7580
func getMachinesInFailureDomain(vsphereInfraSpec *configv1.VSpherePlatformSpec,
7681
fd configv1.VSpherePlatformFailureDomainSpec,
7782
machines *machinev1beta1.MachineList) ([]machinev1beta1.Machine, error) {
83+
84+
By("getting machines in failure domain")
85+
7886
if len(vsphereInfraSpec.FailureDomains) < 2 {
7987
return machines.Items, nil
8088
}
@@ -106,6 +114,9 @@ func getMachinesInFailureDomain(vsphereInfraSpec *configv1.VSpherePlatformSpec,
106114
}
107115

108116
func getProviderFromMachineSet(cfg *rest.Config) *v1beta1.VSphereMachineProviderSpec {
117+
118+
By("getting provider from machineset")
119+
109120
workerMachineSets, err := util.GetMachineSets(cfg)
110121
Expect(err).NotTo(HaveOccurred())
111122
Expect(len(workerMachineSets.Items)).NotTo(Equal(0), "cluster should have at least 1 worker machine set created by installer")

0 commit comments

Comments
 (0)