Skip to content

Commit 0c4edb3

Browse files
committed
functest: add retry for rdma functest
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]>
1 parent d172b52 commit 0c4edb3

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

test/conformance/tests/test_networkpool.go

+20-24
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,13 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
7474
Expect(nodeState.Status.System.RdmaMode).To(Equal(consts.RdmaSubsystemModeExclusive))
7575

7676
By("Checking rdma mode and kernel args")
77-
output, _, err := runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=0 | wc -l")
77+
cmdlineOutput, _, err := runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline")
78+
errDescription := fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput)
7879
Expect(err).ToNot(HaveOccurred())
79-
Expect(strings.HasPrefix(output, "1")).To(BeTrue())
80-
81-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=1 | wc -l")
82-
Expect(err).ToNot(HaveOccurred())
83-
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
80+
Expect(cmdlineOutput).To(ContainSubstring("ib_core.netns_mode=0"), errDescription)
81+
Expect(cmdlineOutput).ToNot(ContainSubstring("ib_core.netns_mode=1"), errDescription)
8482

85-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/etc/modprobe.d/sriov_network_operator_modules_config.conf | grep mode=0 | wc -l")
83+
output, _, err := runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/etc/modprobe.d/sriov_network_operator_modules_config.conf | grep mode=0 | wc -l")
8684
Expect(err).ToNot(HaveOccurred())
8785
Expect(strings.HasPrefix(output, "1")).To(BeTrue())
8886

@@ -97,21 +95,22 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
9795
Expect(nodeState.Status.System.RdmaMode).To(Equal(consts.RdmaSubsystemModeShared))
9896

9997
By("Checking rdma mode and kernel args")
100-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=0 | wc -l")
98+
cmdlineOutput, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline")
99+
errDescription = fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput)
101100
Expect(err).ToNot(HaveOccurred())
102-
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
103-
104-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=1 | wc -l")
105-
Expect(err).ToNot(HaveOccurred())
106-
Expect(strings.HasPrefix(output, "1")).To(BeTrue())
101+
Expect(cmdlineOutput).ToNot(ContainSubstring("ib_core.netns_mode=0"), errDescription)
102+
Expect(cmdlineOutput).To(ContainSubstring("ib_core.netns_mode=1"), errDescription)
107103

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

112108
By("removing rdma mode configuration")
113-
err = clients.Delete(context.Background(), networkPool)
114-
Expect(err).ToNot(HaveOccurred())
109+
Eventually(func(g Gomega) {
110+
err = clients.Delete(context.Background(), networkPool)
111+
g.Expect(err).ToNot(HaveOccurred())
112+
}, 5*time.Minute, 5*time.Second).Should(Succeed())
113+
115114
WaitForSRIOVStable()
116115

117116
err = clients.Get(context.Background(), client.ObjectKey{Name: testNode, Namespace: operatorNamespace}, nodeState)
@@ -120,17 +119,14 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
120119
Expect(nodeState.Status.System.RdmaMode).To(Equal(consts.RdmaSubsystemModeShared))
121120

122121
By("Checking rdma mode and kernel args")
123-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=0 | wc -l")
124-
Expect(err).ToNot(HaveOccurred())
125-
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
126-
127-
output, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline | grep ib_core.netns_mode=1 | wc -l")
128-
Expect(err).ToNot(HaveOccurred())
129-
Expect(strings.HasPrefix(output, "0")).To(BeTrue())
122+
cmdlineOutput, _, err = runCommandOnConfigDaemon(testNode, "/bin/bash", "-c", "cat /host/proc/cmdline")
123+
errDescription = fmt.Sprintf("kernel args are not right, printing current kernel args %s", cmdlineOutput)
124+
Expect(cmdlineOutput).ToNot(ContainSubstring("ib_core.netns_mode=0"), errDescription)
125+
Expect(cmdlineOutput).ToNot(ContainSubstring("ib_core.netns_mode=1"), errDescription)
130126

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

0 commit comments

Comments
 (0)