tests, LoginToAlpine: if vmi.Spec.Hostname exists expect it in the prompt
@@ -82,10 +82,12 @@ func LoginToAlpine(vmi *v1.VirtualMachineInstance) error {
return err
}
+ hostName := dns.SanitizeHostname(vmi)
+
// Do not login, if we already logged in
b := append([]expect.Batcher{
&expect.BSnd{S: "\n"},
- &expect.BExp{R: fmt.Sprintf(`(localhost|%s):~\\# `, vmi.Name)},
+ &expect.BExp{R: fmt.Sprintf(`(localhost|%s):~\# `, hostName)},
})
_, err = expecter.ExpectBatch(b, 5*time.Second)
if err == nil {
@@ -94,7 +96,7 @@ func LoginToAlpine(vmi *v1.VirtualMachineInstance) error {
b = append([]expect.Batcher{
&expect.BSnd{S: "\n"},
- &expect.BExp{R: fmt.Sprintf(`(localhost|%s) login: `, vmi.Name)},
+ &expect.BExp{R: fmt.Sprintf(`(localhost|%s) login: `, hostName)},
&expect.BSnd{S: "root\n"},
&expect.BExp{R: PromptExpression}})
res, err := expecter.ExpectBatch(b, 180*time.Second)
