|
6 | 6 | "fmt"
|
7 | 7 | "slices"
|
8 | 8 | "strings"
|
| 9 | + "time" |
9 | 10 |
|
10 | 11 | . "github.com/onsi/ginkgo/v2"
|
11 | 12 | . "github.com/onsi/gomega"
|
@@ -235,6 +236,14 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
|
235 | 236 | })
|
236 | 237 |
|
237 | 238 | It("new machines should pass multi network tests [Serial][apigroup:machine.openshift.io][Suite:openshift/conformance/serial]", Label("Serial"), func() {
|
| 239 | + |
| 240 | + By("checking initial cluster size") |
| 241 | + nodeList, err := c.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) |
| 242 | + Expect(err).NotTo(HaveOccurred()) |
| 243 | + |
| 244 | + initialNumberOfNodes := len(nodeList.Items) |
| 245 | + By(fmt.Sprintf("initial cluster size is %v", initialNumberOfNodes)) |
| 246 | + |
238 | 247 | machineSets, err := e2eutil.GetMachineSets(cfg)
|
239 | 248 | Expect(err).NotTo(HaveOccurred())
|
240 | 249 |
|
@@ -298,5 +307,19 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:VSphereMultiNetworks][p
|
298 | 307 | }
|
299 | 308 | return ms.Status.ReadyReplicas, nil
|
300 | 309 | }, machineReadyTimeout).Should(BeEquivalentTo(origReplicas))
|
| 310 | + |
| 311 | + // By this point, the node object should be deleted, but seems it may linger momentarily causing issue with other tests that grab current |
| 312 | + // nodes to perform tests against. |
| 313 | + By(fmt.Sprintf("waiting for cluster to get back to original size. Final size should be %d worker nodes", initialNumberOfNodes)) |
| 314 | + Eventually(func() bool { |
| 315 | + nodeList, err := c.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) |
| 316 | + Expect(err).NotTo(HaveOccurred()) |
| 317 | + By(fmt.Sprintf("got %v nodes, expecting %v", len(nodeList.Items), initialNumberOfNodes)) |
| 318 | + if len(nodeList.Items) != initialNumberOfNodes { |
| 319 | + return false |
| 320 | + } |
| 321 | + |
| 322 | + return true |
| 323 | + }, 10*time.Minute, 5*time.Second).Should(BeTrue(), "number of nodes should be the same as it was before test started") |
301 | 324 | })
|
302 | 325 | })
|
0 commit comments