Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit d8348ec

Browse files
author
Yifan Gu
committed
e2e: Wait until the node comes up in Reboot().
1 parent 3903f4c commit d8348ec

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

e2e/node.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package e2e
22

33
import (
4+
"bytes"
45
"fmt"
6+
"time"
57

68
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
79
"k8s.io/client-go/pkg/api/v1"
@@ -50,7 +52,19 @@ func (n *Node) Reboot() error {
5052
if err != nil {
5153
return fmt.Errorf("issuing reboot command failed\nstdout:%s\nstderr:%s", stdout, stderr)
5254
}
53-
return nil
55+
56+
checker := func() error {
57+
stdout, stderr, err = n.SSH("systemctl is-system-running")
58+
if err != nil {
59+
return err
60+
}
61+
if !bytes.Contains(stdout, []byte("running")) {
62+
return fmt.Errorf("system is not running yet")
63+
}
64+
return nil
65+
}
66+
67+
return retry(20, 10*time.Second, checker)
5468
}
5569

5670
// IsMaster returns true if the node's labels contains "node-role.kubernetes.io/master".

0 commit comments

Comments
 (0)