@@ -50,6 +50,7 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
50
50
framework .ExpectNoError (err , "Error finding Windows node" )
51
51
framework .Logf ("Using node: %v" , targetNode .Name )
52
52
53
+ bootID := targetNode .Status .NodeInfo .BootID
53
54
windowsImage := imageutils .GetE2EImage (imageutils .Agnhost )
54
55
55
56
// Create Windows pod on the selected Windows node Using Agnhost
@@ -176,32 +177,24 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
176
177
177
178
restartCount := 0
178
179
179
- timeout := time .After (time .Minute * 10 )
180
- FOR:
181
- for {
182
- select {
183
- case <- timeout :
184
- break FOR
185
- default :
186
- if restartCount > 0 {
187
- break FOR
188
- }
189
- ginkgo .By ("Then checking existed agn-test-pod is running on the rebooted host" )
190
- agnPodOut , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (ctx , agnPod .Name , metav1.GetOptions {})
191
- if err == nil {
192
- lastRestartCount := podutil .GetExistingContainerStatus (agnPodOut .Status .ContainerStatuses , "windows-container" ).RestartCount
193
- restartCount = int (lastRestartCount - initialRestartCount )
194
- }
195
- time .Sleep (time .Second * 30 )
180
+ ginkgo .By ("Waiting for nodes to be rebooted" )
181
+ gomega .Eventually (ctx , func (ctx context.Context ) string {
182
+ refreshNode , err := f .ClientSet .CoreV1 ().Nodes ().Get (ctx , targetNode .Name , metav1.GetOptions {})
183
+ if err != nil {
184
+ return ""
196
185
}
197
- }
198
-
199
- ginkgo .By ("Checking whether agn-test-pod is rebooted" )
200
- gomega .Expect (restartCount ).To (gomega .Equal (1 ), "restart count of agn-test-pod is 1" )
186
+ return refreshNode .Status .NodeInfo .BootID
187
+ }).WithPolling (time .Second * 30 ).WithTimeout (time .Minute * 10 ).
188
+ Should (gomega .BeNumerically (">" , bootID ), "node was not rebooted" )
201
189
190
+ ginkgo .By ("Then checking existed agn-test-pod is running on the rebooted host" )
202
191
agnPodOut , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (ctx , agnPod .Name , metav1.GetOptions {})
203
- gomega .Expect (agnPodOut .Status .Phase ).To (gomega .Equal (v1 .PodRunning ))
204
192
framework .ExpectNoError (err , "getting pod info after reboot" )
193
+
194
+ lastRestartCount := podutil .GetExistingContainerStatus (agnPodOut .Status .ContainerStatuses , "windows-container" ).RestartCount
195
+ restartCount = int (lastRestartCount - initialRestartCount )
196
+ gomega .Expect (restartCount ).To (gomega .Equal (1 ), "restart count of agn-test-pod is 1" )
197
+ gomega .Expect (agnPodOut .Status .Phase ).To (gomega .Equal (v1 .PodRunning ))
205
198
assertConsistentConnectivity (ctx , f , nginxPod .ObjectMeta .Name , "linux" , linuxCheck (agnPodOut .Status .PodIP , 80 ), internalMaxTries )
206
199
207
200
// create another host process pod to check system boot time
0 commit comments