Implement e2e test for node out of disk condition.

This is a second attempt at this commit and it fixes the cause for its
flakiness in the first attempt.

The ability to SSH into individual nodes, described by api.Node, and running
commands on them appears to be useful for other e2e tests too. So, move
issueSSHCommand utility function to e2e util file.

Also, modify waitForNodeToBe e2e util function to take any node condition. The
current implementation only takes api.NodeReady condition into consideration.
This change makes the function take any node condition.
This commit is contained in:
Madhusudan.C.S
2015-10-27 17:05:38 -07:00
parent a7425bf070
commit e3a26bfea6
7 changed files with 307 additions and 42 deletions

View File

@@ -149,26 +149,6 @@ func testReboot(c *client.Client, rebootCmd string) {
}
}
func issueSSHCommand(node *api.Node, provider, cmd string) error {
Logf("Getting external IP address for %s", node.Name)
host := ""
for _, a := range node.Status.Addresses {
if a.Type == api.NodeExternalIP {
host = a.Address + ":22"
break
}
}
if host == "" {
return fmt.Errorf("couldn't find external IP address for node %s", node.Name)
}
Logf("Calling %s on %s", cmd, node.Name)
if result, err := SSH(cmd, host, provider); result.Code != 0 || err != nil {
LogSSHResult(result)
return fmt.Errorf("failed running %q: %v (exit code %d)", cmd, err, result.Code)
}
return nil
}
// rebootNode takes node name on provider through the following steps using c:
// - ensures the node is ready
// - ensures all pods on the node are running and ready
@@ -223,7 +203,7 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string) bool {
}
// Reboot the node.
if err = issueSSHCommand(node, provider, rebootCmd); err != nil {
if err = issueSSHCommand(rebootCmd, provider, node); err != nil {
Logf("Error while issuing ssh command: %v", err)
return false
}