Skip to content

Commit

Permalink
functest: add retry for rdma functest
Browse files Browse the repository at this point in the history
this is needed because after a reboot on a single node
the operator webhook may not be ready

Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Dec 16, 2024
1 parent d172b52 commit f68bdf1
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/conformance/tests/test_networkpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,49 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
Expect(nodeState.Status.System.RdmaMode).To(Equal(consts.RdmaSubsystemModeShared))

By("Checking rdma mode and kernel args")
cmdlineOutput, _, err := runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline")
Expect(err).ToNot(HaveOccurred())

output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=0 | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
Expect(strings.HasPrefix(output, "0")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))

output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=1 | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "1")).To(BeTrue())
Expect(strings.HasPrefix(output, "1")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))

output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/etc/modprobe.d/sriov_network_operator_modules_config.conf | grep mode=1 | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "1")).To(BeTrue())
Expect(strings.HasPrefix(output, "1")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))

By("removing rdma mode configuration")
err = clients.Delete(context.Background(), networkPool)
Expect(err).ToNot(HaveOccurred())
Eventually(func(g Gomega) {
err = clients.Delete(context.Background(), networkPool)
g.Expect(err).ToNot(HaveOccurred())
}, 5*time.Minute, 5*time.Second).Should(Succeed())

WaitForSRIOVStable()

err = clients.Get(context.Background(), client.ObjectKey{Name: testNode, Namespace: operatorNamespace}, nodeState)
Expect(err).ToNot(HaveOccurred())
Expect(nodeState.Spec.System.RdmaMode).To(Equal(""))
Expect(nodeState.Status.System.RdmaMode).To(Equal(consts.RdmaSubsystemModeShared))

cmdlineOutput, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline")
Expect(err).ToNot(HaveOccurred())

By("Checking rdma mode and kernel args")
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=0 | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
Expect(strings.HasPrefix(output, "0")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))

output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=1 | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
Expect(strings.HasPrefix(output, "0")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))

output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "ls /host/etc/modprobe.d | grep sriov_network_operator_modules_config.conf | wc -l")
Expect(err).ToNot(HaveOccurred())
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
Expect(strings.HasPrefix(output, "0")).To(BeTrue(), fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput))
})
})

Expand Down

0 comments on commit f68bdf1

Please sign in to comment.