Skip to content

Commit 59a1a5f

Browse files
Merge pull request #1388 from vr4manta/SPLAT-2300
OCPBUGS-58429: Fixed test logic to wait for machines ready and clean up
2 parents 86404b8 + 026600e commit 59a1a5f

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

test/e2e/vsphere/multi-nic.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,23 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
241241
Expect(len(machineSets.Items)).ShouldNot(Equal(0))
242242

243243
machineSet := machineSets.Items[0]
244+
origReplicas := int(*machineSet.Spec.Replicas)
244245

245246
// scale up new machine and wait for scale up to complete
246247
By("scaling up a new machineset which should have multiple NICs")
247-
err = e2eutil.ScaleMachineSet(cfg, machineSet.Name, int(*machineSet.Spec.Replicas)+1)
248+
err = e2eutil.ScaleMachineSet(cfg, machineSet.Name, origReplicas+1)
248249
Expect(err).NotTo(HaveOccurred())
249250

251+
// Verify / wait for machine is ready
252+
By("verifying machine became ready")
253+
Eventually(func() (int32, error) {
254+
ms, err := mc.MachineSets(e2eutil.MachineAPINamespace).Get(ctx, machineSet.Name, metav1.GetOptions{})
255+
if err != nil {
256+
return -1, err
257+
}
258+
return ms.Status.ReadyReplicas, nil
259+
}, machineReadyTimeout).Should(BeEquivalentTo(origReplicas + 1))
260+
250261
nodes, err = c.CoreV1().Nodes().List(ctx, v1.ListOptions{})
251262
Expect(err).NotTo(HaveOccurred())
252263

@@ -272,5 +283,20 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
272283
failIfNodeNetworkingInconsistentWithMachineNetwork(infra.Spec.PlatformSpec, machineNetworks)
273284
failIfMachinesDoNotHaveAllPortgroups(infra.Spec.PlatformSpec, machines)
274285
failIfIncorrectPortgroupsAttachedToVMs(ctx, infra, nodes, vsphereCreds)
286+
287+
// Scale down machineset
288+
By("scaling down the machineset")
289+
err = e2eutil.ScaleMachineSet(cfg, machineSet.Name, origReplicas)
290+
Expect(err).NotTo(HaveOccurred())
291+
292+
// Verify / wait for machine is removed
293+
By("verifying machine is destroyed")
294+
Eventually(func() (int32, error) {
295+
ms, err := mc.MachineSets(e2eutil.MachineAPINamespace).Get(ctx, machineSet.Name, metav1.GetOptions{})
296+
if err != nil {
297+
return -1, err
298+
}
299+
return ms.Status.ReadyReplicas, nil
300+
}, machineReadyTimeout).Should(BeEquivalentTo(origReplicas))
275301
})
276302
})

0 commit comments

Comments
 (0)