kola: add coreos.locksmith.reboot test
Adds a test that ensures that locksmith can successfully reboot without
etcd in the default configuration.
@@ -66,7 +66,11 @@ func init() {
"mode": 420
}]
}
-}`),
+}`)})
+ register.Register(&register.Test{
+ Name: "coreos.locksmith.reboot",
+ Run: locksmithReboot,
+ ClusterSize: 1,
})
register.Register(&register.Test{
Name: "coreos.locksmith.tls",
@@ -117,6 +121,27 @@ func init() {
})
}
+func locksmithReboot(c cluster.TestCluster) {
+ // The machine should be able to reboot without etcd in the default mode
+ m := c.Machines()[0]
+
+ output, err := m.SSH("sudo systemctl stop sshd.socket && locksmithctl send-need-reboot")
+ if _, ok := err.(*ssh.ExitMissingError); ok {
+ err = nil // A terminated session is perfectly normal during reboot.
+ } else if err == io.EOF {
+ err = nil // Sometimes copying command output returns EOF here.
+ }
+ if err != nil {
+ c.Fatalf("failed to run \"locksmithctl send-need-reboot\": output: %q status: %q", output, err)
+ }
+
+ err = platform.CheckMachine(m)
+ if err != nil {
+ c.Fatalf("failed to check rebooted machine: %v", err)
+ }
+
+}
+
func locksmithCluster(c cluster.TestCluster) {
machs := c.Machines()
