Skip to content

Commit f161200

Browse files
committed
Fix the node reboot validation failure
1 parent 052d7a5 commit f161200

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/e2e/windows/reboot_node.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package windows
1818

1919
import (
2020
"context"
21+
"strconv"
2122
"time"
2223

2324
"github.com/onsi/ginkgo/v2"
@@ -50,7 +51,8 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
5051
framework.ExpectNoError(err, "Error finding Windows node")
5152
framework.Logf("Using node: %v", targetNode.Name)
5253

53-
bootID := targetNode.Status.NodeInfo.BootID
54+
bootID, err := strconv.Atoi(targetNode.Status.NodeInfo.BootID)
55+
framework.ExpectNoError(err, "Error converting bootID to int")
5456
windowsImage := imageutils.GetE2EImage(imageutils.Agnhost)
5557

5658
// Create Windows pod on the selected Windows node Using Agnhost
@@ -178,12 +180,17 @@ var _ = sigDescribe(feature.Windows, "[Excluded:WindowsDocker] [MinimumKubeletVe
178180
restartCount := 0
179181

180182
ginkgo.By("Waiting for nodes to be rebooted")
181-
gomega.Eventually(ctx, func(ctx context.Context) string {
183+
gomega.Eventually(ctx, func(ctx context.Context) int {
182184
refreshNode, err := f.ClientSet.CoreV1().Nodes().Get(ctx, targetNode.Name, metav1.GetOptions{})
183185
if err != nil {
184-
return ""
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
185193
}
186-
return refreshNode.Status.NodeInfo.BootID
187194
}).WithPolling(time.Second*30).WithTimeout(time.Minute*10).
188195
Should(gomega.BeNumerically(">", bootID), "node was not rebooted")
189196

0 commit comments

Comments
 (0)