mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Add the check of node rebooting in windows rebootnode test
This commit is contained in:
		@@ -50,6 +50,7 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
 | 
			
		||||
		framework.ExpectNoError(err, "Error finding Windows node")
 | 
			
		||||
		framework.Logf("Using node: %v", targetNode.Name)
 | 
			
		||||
 | 
			
		||||
		bootID := targetNode.Status.NodeInfo.BootID
 | 
			
		||||
		windowsImage := imageutils.GetE2EImage(imageutils.Agnhost)
 | 
			
		||||
 | 
			
		||||
		// Create Windows pod on the selected Windows node Using Agnhost
 | 
			
		||||
@@ -176,32 +177,24 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
 | 
			
		||||
 | 
			
		||||
		restartCount := 0
 | 
			
		||||
 | 
			
		||||
		timeout := time.After(time.Minute * 10)
 | 
			
		||||
	FOR:
 | 
			
		||||
		for {
 | 
			
		||||
			select {
 | 
			
		||||
			case <-timeout:
 | 
			
		||||
				break FOR
 | 
			
		||||
			default:
 | 
			
		||||
				if restartCount > 0 {
 | 
			
		||||
					break FOR
 | 
			
		||||
				}
 | 
			
		||||
				ginkgo.By("Then checking existed agn-test-pod is running on the rebooted host")
 | 
			
		||||
				agnPodOut, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, agnPod.Name, metav1.GetOptions{})
 | 
			
		||||
				if err == nil {
 | 
			
		||||
					lastRestartCount := podutil.GetExistingContainerStatus(agnPodOut.Status.ContainerStatuses, "windows-container").RestartCount
 | 
			
		||||
					restartCount = int(lastRestartCount - initialRestartCount)
 | 
			
		||||
				}
 | 
			
		||||
				time.Sleep(time.Second * 30)
 | 
			
		||||
		ginkgo.By("Waiting for nodes to be rebooted")
 | 
			
		||||
		gomega.Eventually(ctx, func(ctx context.Context) string {
 | 
			
		||||
			refreshNode, err := f.ClientSet.CoreV1().Nodes().Get(ctx, targetNode.Name, metav1.GetOptions{})
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return ""
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ginkgo.By("Checking whether agn-test-pod is rebooted")
 | 
			
		||||
		gomega.Expect(restartCount).To(gomega.Equal(1), "restart count of agn-test-pod is 1")
 | 
			
		||||
			return refreshNode.Status.NodeInfo.BootID
 | 
			
		||||
		}).WithPolling(time.Second*30).WithTimeout(time.Minute*10).
 | 
			
		||||
			Should(gomega.BeNumerically(">", bootID), "node was not rebooted")
 | 
			
		||||
 | 
			
		||||
		ginkgo.By("Then checking existed agn-test-pod is running on the rebooted host")
 | 
			
		||||
		agnPodOut, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, agnPod.Name, metav1.GetOptions{})
 | 
			
		||||
		gomega.Expect(agnPodOut.Status.Phase).To(gomega.Equal(v1.PodRunning))
 | 
			
		||||
		framework.ExpectNoError(err, "getting pod info after reboot")
 | 
			
		||||
 | 
			
		||||
		lastRestartCount := podutil.GetExistingContainerStatus(agnPodOut.Status.ContainerStatuses, "windows-container").RestartCount
 | 
			
		||||
		restartCount = int(lastRestartCount - initialRestartCount)
 | 
			
		||||
		gomega.Expect(restartCount).To(gomega.Equal(1), "restart count of agn-test-pod is 1")
 | 
			
		||||
		gomega.Expect(agnPodOut.Status.Phase).To(gomega.Equal(v1.PodRunning))
 | 
			
		||||
		assertConsistentConnectivity(ctx, f, nginxPod.ObjectMeta.Name, "linux", linuxCheck(agnPodOut.Status.PodIP, 80), internalMaxTries)
 | 
			
		||||
 | 
			
		||||
		// create another host process pod to check system boot time
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user