Skip to content

Commit

Permalink
e2e: fix a race in [reboots] tests.
Browse files Browse the repository at this point in the history
Wait for a flip to MachineConfigPool UpdatedMachineCount == 0 prior to
waiting for it to be updated (== 1) again.
  • Loading branch information
jmencak committed Aug 19, 2022
1 parent c5cf0bd commit b1788b1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/e2e/reboots/kernel_parameter_add_rm.go
Expand Up @@ -83,9 +83,17 @@ var _ = ginkgo.Describe("[reboots][kernel_parameter_add_rm] Node Tuning Operator
_, _, err = util.ExecAndLogCommand("oc", "create", "-f", mcpRealtime)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 1")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 1)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
waitForMCPFlip := func() {
// By creating the custom child profile, we will first see worker-rt MachineConfigPool UpdatedMachineCount drop to 0 first...
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 0")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 0)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// ...and go up to 1 again next.
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 1")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 1)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}
waitForMCPFlip()

ginkgo.By(fmt.Sprintf("getting the current %s value in Pod %s", procCmdline, pod.Name))
cmdlineNew, err := util.WaitForCmdInPod(pollInterval, waitDuration, pod, cmdCatCmdline...)
Expand All @@ -102,14 +110,7 @@ var _ = ginkgo.Describe("[reboots][kernel_parameter_add_rm] Node Tuning Operator
_, _, err = util.ExecAndLogCommand("oc", "create", "-n", ntoconfig.OperatorNamespace(), "-f", profileChild)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// By creating the custom child profile, we will first see worker-rt MachineConfigPool UpdatedMachineCount drop to 0 first...
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 0")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 0)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// ...and go up to 1 again next.
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 1")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 1)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
waitForMCPFlip()

ginkgo.By(fmt.Sprintf("getting the current %s value in Pod %s", procCmdline, pod.Name))
cmdlineNew, err = util.WaitForCmdInPod(pollInterval, waitDuration, pod, cmdCatCmdline...)
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/reboots/machine_config_labels.go
Expand Up @@ -77,6 +77,11 @@ var _ = ginkgo.Describe("[reboots][machine_config_labels] Node Tuning Operator m
_, _, err = util.ExecAndLogCommand("oc", "create", "-f", mcpRealtime)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// By creating the custom child profile, we will first see worker-rt MachineConfigPool UpdatedMachineCount drop to 0 first...
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 0")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 0)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// ...and go up to 1 again next.
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 1")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 1)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/reboots/stalld.go
Expand Up @@ -71,6 +71,11 @@ var _ = ginkgo.Describe("[reboots][stalld] Node Tuning Operator installing syste
_, _, err = util.ExecAndLogCommand("oc", "create", "-f", mcpRealtime)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// By creating the custom child profile, we will first see worker-rt MachineConfigPool UpdatedMachineCount drop to 0 first...
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 0")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 0)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// ...and go up to 1 again next.
ginkgo.By("waiting for worker-rt MachineConfigPool UpdatedMachineCount == 1")
err = util.WaitForPoolUpdatedMachineCount(cs, "worker-rt", 1)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down

0 comments on commit b1788b1

Please sign in to comment.