@@ -53,6 +53,8 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
53
53
54
54
bootID , err := strconv .Atoi (targetNode .Status .NodeInfo .BootID )
55
55
framework .ExpectNoError (err , "Error converting bootID to int" )
56
+ framework .Logf ("Initial BootID: %d" , bootID )
57
+
56
58
windowsImage := imageutils .GetE2EImage (imageutils .Agnhost )
57
59
58
60
// Create Windows pod on the selected Windows node Using Agnhost
@@ -179,29 +181,40 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
179
181
180
182
restartCount := 0
181
183
182
- ginkgo .By ("Waiting for nodes to be rebooted" )
183
- gomega .Eventually (ctx , func (ctx context.Context ) int {
184
- refreshNode , err := f .ClientSet .CoreV1 ().Nodes ().Get (ctx , targetNode .Name , metav1.GetOptions {})
185
- if err != nil {
186
- return - 1
187
- }
188
- num , err := strconv .Atoi (refreshNode .Status .NodeInfo .BootID ) // Attempt to convert empty string
189
- if err != nil {
190
- return - 1 // strconv.Atoi: parsing "": invalid syntax
191
- } else {
192
- return num
184
+ timeout := time .After (time .Minute * 10 )
185
+ FOR:
186
+ for {
187
+ select {
188
+ case <- timeout :
189
+ break FOR
190
+ default :
191
+ if restartCount > 0 {
192
+ break FOR
193
+ }
194
+ ginkgo .By ("Then checking existed agn-test-pod is running on the rebooted host" )
195
+ agnPodOut , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (ctx , agnPod .Name , metav1.GetOptions {})
196
+ if err == nil {
197
+ lastRestartCount := podutil .GetExistingContainerStatus (agnPodOut .Status .ContainerStatuses , "windows-container" ).RestartCount
198
+ restartCount = int (lastRestartCount - initialRestartCount )
199
+ }
200
+ time .Sleep (time .Second * 30 )
193
201
}
194
- }).WithPolling (time .Second * 30 ).WithTimeout (time .Minute * 10 ).
195
- Should (gomega .BeNumerically (">" , bootID ), "node was not rebooted" )
202
+ }
196
203
197
- ginkgo .By ("Then checking existed agn-test-pod is running on the rebooted host" )
198
- agnPodOut , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (ctx , agnPod .Name , metav1.GetOptions {})
199
- framework .ExpectNoError (err , "getting pod info after reboot" )
204
+ ginkgo .By ("Checking whether the node is rebooted" )
205
+ refreshNode , err := f .ClientSet .CoreV1 ().Nodes ().Get (ctx , targetNode .Name , metav1.GetOptions {})
206
+ framework .ExpectNoError (err , "Error getting node info after reboot" )
207
+ currentbootID , err := strconv .Atoi (refreshNode .Status .NodeInfo .BootID )
208
+ framework .ExpectNoError (err , "Error converting bootID to int" )
209
+ framework .Logf ("current BootID: %d" , currentbootID )
210
+ gomega .Expect (currentbootID ).To (gomega .Equal (bootID + 1 ), "BootID should be incremented by 1 after reboot" )
200
211
201
- lastRestartCount := podutil .GetExistingContainerStatus (agnPodOut .Status .ContainerStatuses , "windows-container" ).RestartCount
202
- restartCount = int (lastRestartCount - initialRestartCount )
212
+ ginkgo .By ("Checking whether agn-test-pod is rebooted" )
203
213
gomega .Expect (restartCount ).To (gomega .Equal (1 ), "restart count of agn-test-pod is 1" )
214
+
215
+ agnPodOut , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (ctx , agnPod .Name , metav1.GetOptions {})
204
216
gomega .Expect (agnPodOut .Status .Phase ).To (gomega .Equal (v1 .PodRunning ))
217
+ framework .ExpectNoError (err , "getting pod info after reboot" )
205
218
assertConsistentConnectivity (ctx , f , nginxPod .ObjectMeta .Name , "linux" , linuxCheck (agnPodOut .Status .PodIP , 80 ), internalMaxTries )
206
219
207
220
// create another host process pod to check system boot time
0 commit comments