@@ -74,15 +74,13 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
74
74
Expect (nodeState .Status .System .RdmaMode ).To (Equal (consts .RdmaSubsystemModeExclusive ))
75
75
76
76
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 )
78
79
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 )
84
82
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" )
86
84
Expect (err ).ToNot (HaveOccurred ())
87
85
Expect (strings .HasPrefix (output , "1" )).To (BeTrue ())
88
86
@@ -97,21 +95,22 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
97
95
Expect (nodeState .Status .System .RdmaMode ).To (Equal (consts .RdmaSubsystemModeShared ))
98
96
99
97
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 )
101
100
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 )
107
103
108
104
output , _ , err = runCommandOnConfigDaemon (testNode , "/bin/bash" , "-c" , "cat /host/etc/modprobe.d/sriov_network_operator_modules_config.conf | grep mode=1 | wc -l" )
109
105
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 ) )
111
107
112
108
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
+
115
114
WaitForSRIOVStable ()
116
115
117
116
err = clients .Get (context .Background (), client.ObjectKey {Name : testNode , Namespace : operatorNamespace }, nodeState )
@@ -120,17 +119,14 @@ var _ = Describe("[sriov] NetworkPool", Ordered, func() {
120
119
Expect (nodeState .Status .System .RdmaMode ).To (Equal (consts .RdmaSubsystemModeShared ))
121
120
122
121
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 )
130
126
131
127
output , _ , err = runCommandOnConfigDaemon (testNode , "/bin/bash" , "-c" , "ls /host/etc/modprobe.d | grep sriov_network_operator_modules_config.conf | wc -l" )
132
128
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 ) )
134
130
})
135
131
})
136
132
0 commit comments