Skip to content

Commit

Permalink
Merge pull request kubevirt#3956 from AlonaKaplan/retValueAnyPrompt
Browse files Browse the repository at this point in the history
tests: "utils.RetValue" no need to pass prompt
  • Loading branch information
kubevirt-bot authored Aug 15, 2020
2 parents 1d4df01 + ad05e92 commit 3a69a73
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 65 deletions.
16 changes: 8 additions & 8 deletions tests/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
// mount iso ConfigMap image
&expect.BSnd{S: "mount /dev/sda /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/option1 /mnt/option2 /mnt/option3\n"},
&expect.BExp{R: expectedOutput},
}, 200*time.Second)
Expand Down Expand Up @@ -199,7 +199,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
// mount iso Secret image
&expect.BSnd{S: "mount /dev/sda /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/user /mnt/password\n"},
&expect.BExp{R: expectedOutput},
}, 200*time.Second)
Expand Down Expand Up @@ -282,7 +282,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
// mount service account iso image
&expect.BSnd{S: "mount /dev/sda /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/namespace\n"},
&expect.BExp{R: tests.NamespaceTestDefault},
&expect.BSnd{S: "tail -c 20 /mnt/token\n"},
Expand Down Expand Up @@ -377,7 +377,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
&expect.BExp{R: "#"},
&expect.BSnd{S: "mount /dev/vdc /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/config1 /mnt/config2 /mnt/config3\n"},
&expect.BExp{R: expectedOutputCfgMap},
}, 200*time.Second)
Expand All @@ -403,7 +403,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
// mount Secret image
&expect.BSnd{S: "mount /dev/vdd /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/user /mnt/password\n"},
&expect.BExp{R: expectedOutputSecret},
}, 200*time.Second)
Expand Down Expand Up @@ -501,13 +501,13 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp
&expect.BExp{R: "\\#"},
&expect.BSnd{S: "mount /dev/sda /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "grep \"PRIVATE KEY\" /mnt/ssh-privatekey\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "grep ssh-rsa /mnt/ssh-publickey\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
}, 200*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down
4 changes: 2 additions & 2 deletions tests/container_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp
// mount virtio cdrom and check files are there
&expect.BSnd{S: "mount -t iso9600 /dev/cdrom\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cd /media/cdrom\n"},
&expect.BSnd{S: "ls virtio-win_license.txt guest-agent\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
}, 200*time.Second)
Expect(err).ToNot(HaveOccurred(), "expected virtio files to be mounted properly")
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pausing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ var _ = Describe("[rfe_id:3064][crit:medium][vendor:[email protected]][level:com
grepSleepPid := func(expecter expect.Expecter) string {
res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: `pgrep -f "sleep 5"` + "\n"},
&expect.BExp{R: tests.RetValue("[0-9]+", "\\# ")}, // pid
&expect.BExp{R: tests.RetValue("[0-9]+")}, // pid
}, 15*time.Second)
log.DefaultLogger().Infof("a:%+v\n", res)
Expect(err).ToNot(HaveOccurred())
Expand Down
11 changes: 4 additions & 7 deletions tests/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ import (
"kubevirt.io/client-go/log"
)

const promptExpression = `(\$ |\# )`
const termNLExpression = "\r\n"

var (
shellSuccess = regexp.MustCompile("\n0" + termNLExpression + ".*" + promptExpression)
shellFail = regexp.MustCompile("\n[1-9].*" + termNLExpression + ".*" + promptExpression)
shellSuccess = regexp.MustCompile(RetValue("0"))
shellFail = regexp.MustCompile(RetValue("[1-9].*"))
)

// PingFromVMConsole performs a ping through the provided VMI console.
Expand All @@ -62,9 +59,9 @@ func PingFromVMConsole(vmi *v1.VirtualMachineInstance, ipAddr string, args ...st

err := vmiConsoleExpectBatch(vmi, []expect.Batcher{
&expect.BSnd{S: "\n"},
&expect.BExp{R: promptExpression},
&expect.BExp{R: PromptExpression},
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: promptExpression},
&expect.BExp{R: PromptExpression},
&expect.BSnd{S: "echo $?\n"},
&expect.BCas{C: []expect.Caser{
&expect.Case{
Expand Down
8 changes: 4 additions & 4 deletions tests/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ var _ = Describe("Storage", func() {
&expect.BSnd{S: "sudo mkfs.ext4 /dev/vdc\n"},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\$ ")},
&expect.BExp{R: tests.RetValue("0")},
}, 20*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -302,7 +302,7 @@ var _ = Describe("Storage", func() {
// Because "/" is mounted on tmpfs, we need something that normally persists writes - /dev/sda2 is the EFI partition formatted as vFAT.
&expect.BSnd{S: "mount /dev/sda2 /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "echo content > /mnt/checkpoint\n"},
// The QEMU process will be killed, therefore the write must be flushed to the disk.
&expect.BSnd{S: "sync\n"},
Expand Down Expand Up @@ -330,10 +330,10 @@ var _ = Describe("Storage", func() {
// Same story as when first starting the VirtualMachineInstance - the checkpoint, if persisted, is located at /dev/sda2.
&expect.BSnd{S: "mount /dev/sda2 /mnt\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
&expect.BSnd{S: "cat /mnt/checkpoint &> /dev/null\n"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("1", "\\#")},
&expect.BExp{R: tests.RetValue("1")},
}, 200*time.Second)
Expect(err).ToNot(HaveOccurred())
})
Expand Down
27 changes: 16 additions & 11 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ type ObjectEventWatcher struct {
dontFailOnMissingEvent bool
}

const (
PromptExpression = `(\$ |\# )`
CRLF = "\r\n"
)

func NewObjectEventWatcher(object runtime.Object) *ObjectEventWatcher {
return &ObjectEventWatcher{object: object, startType: invalidWatch}
}
Expand Down Expand Up @@ -2864,11 +2869,11 @@ func configureConsole(expecter expect.Expecter, prompt string, shouldSudo bool)
&expect.BSnd{S: "stty cols 500 rows 500\n"},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)},
&expect.BExp{R: RetValue("0")},
&expect.BSnd{S: fmt.Sprintf("%sdmesg -n 1\n", sudoString)},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)}})
&expect.BExp{R: RetValue("0")}})
resp, err := expecter.ExpectBatch(batch, 30*time.Second)
if err != nil {
log.DefaultLogger().Infof("%v", resp)
Expand All @@ -2882,7 +2887,7 @@ func configureIPv6OnVMI(vmi *v1.VirtualMachineInstance, expecter expect.Expecter
&expect.BSnd{S: "\n"},
&expect.BExp{R: prompt},
&expect.BSnd{S: "ip a | grep -q eth0; echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)}})
&expect.BExp{R: RetValue("0")}})
_, err := ExpectBatchWithValidatedSend(expecter, hasNetEth0Batch, 30*time.Second)
return err == nil
}
Expand All @@ -2892,7 +2897,7 @@ func configureIPv6OnVMI(vmi *v1.VirtualMachineInstance, expecter expect.Expecter
&expect.BSnd{S: "\n"},
&expect.BExp{R: prompt},
&expect.BSnd{S: "ip -6 address show dev eth0 scope global | grep -q inet6; echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)}})
&expect.BExp{R: RetValue("0")}})
_, err := ExpectBatchWithValidatedSend(expecter, hasGlobalIPv6Batch, 30*time.Second)
return err == nil
}
Expand All @@ -2915,7 +2920,7 @@ func configureIPv6OnVMI(vmi *v1.VirtualMachineInstance, expecter expect.Expecter
&expect.BSnd{S: "\n"},
&expect.BExp{R: prompt},
&expect.BSnd{S: "sudo ip -6 addr add fd10:0:2::2/120 dev eth0; echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)}})
&expect.BExp{R: RetValue("0")}})
resp, err := ExpectBatchWithValidatedSend(expecter, addIPv6Address, 30*time.Second)
if err != nil {
log.DefaultLogger().Object(vmi).Infof("addIPv6Address failed: %v", resp)
Expand All @@ -2928,7 +2933,7 @@ func configureIPv6OnVMI(vmi *v1.VirtualMachineInstance, expecter expect.Expecter
&expect.BSnd{S: "\n"},
&expect.BExp{R: prompt},
&expect.BSnd{S: "sudo ip -6 route add default via fd10:0:2::1 src fd10:0:2::2; echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)}})
&expect.BExp{R: RetValue("0")}})
resp, err = ExpectBatchWithValidatedSend(expecter, addIPv6DefaultRoute, 30*time.Second)
if err != nil {
log.DefaultLogger().Object(vmi).Infof("addIPv6DefaultRoute failed: %v", resp)
Expand Down Expand Up @@ -4263,7 +4268,7 @@ func StartTCPServer(vmi *v1.VirtualMachineInstance, port int) {
&expect.BSnd{S: fmt.Sprintf("screen -d -m nc -klp %d -e echo -e \"Hello World!\"\n", port)},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: RetValue("0", "\\$ ")},
&expect.BExp{R: RetValue("0")},
}, 60*time.Second)
log.DefaultLogger().Infof("%v", resp)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -4294,7 +4299,7 @@ func StartHTTPServer(vmi *v1.VirtualMachineInstance, port int, isFedoraVM bool)
&expect.BSnd{S: httpServerMaker},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: RetValue("0", prompt)},
&expect.BExp{R: RetValue("0")},
}, 60*time.Second)
log.DefaultLogger().Infof("%v", resp)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -4417,7 +4422,7 @@ func GenerateHelloWorldServer(vmi *v1.VirtualMachineInstance, testPort int, prot
&expect.BSnd{S: serverCommand},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: RetValue("0", "\\$ ")},
&expect.BExp{R: RetValue("0")},
}, 60*time.Second)
Expect(err).ToNot(HaveOccurred())
}
Expand Down Expand Up @@ -5035,6 +5040,6 @@ func IsLauncherCapabilityValid(capability k8sv1.Capability) bool {
return false
}

func RetValue(retcode, prompt string) string {
return "\n" + retcode + "\r\n" + ".*" + prompt
func RetValue(retcode string) string {
return "\n" + retcode + CRLF + ".*" + PromptExpression
}
2 changes: 1 addition & 1 deletion tests/vmi_cloudinit_hook_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _ = Describe("CloudInitHookSidecars", func() {
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/vmi_cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var _ = Describe("[rfe_id:151][crit:high][vendor:[email protected]][level:compon
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred())
}
Expand Down
24 changes: 12 additions & 12 deletions tests/vmi_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,11 @@ var _ = Describe("Configurations", func() {

res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(free -m | grep Mem: | tr -s ' ' | cut -d' ' -f2) -gt 200 ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\$ ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "swapoff -a && dd if=/dev/zero of=/dev/shm/test bs=1k count=118k\n"},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\$ ")},
&expect.BExp{R: tests.RetValue("0")},
}, 15*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -621,7 +621,7 @@ var _ = Describe("Configurations", func() {
// Check on the VM, if the Free memory is roughly what we expected
res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(free -m | grep Mem: | tr -s ' ' | cut -d' ' -f2) -gt 95 ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\$ ")},
&expect.BExp{R: tests.RetValue("pass")},
}, 15*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -2024,11 +2024,11 @@ var _ = Describe("Configurations", func() {

res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(free -m | grep Mem: | tr -s ' ' | cut -d' ' -f2) -lt 80 ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\$ ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "swapoff -a && dd if=/dev/zero of=/dev/shm/test bs=1k count=118k\n"},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\$ ")},
&expect.BExp{R: tests.RetValue("0")},
}, 15*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -2373,7 +2373,7 @@ var _ = Describe("Configurations", func() {
// Check on the VM, if expected values are there with dmidecode
res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(sudo dmidecode -s chassis-asset-tag | tr -s ' ') = Test-123 ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
}, 1*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -2417,11 +2417,11 @@ var _ = Describe("Configurations", func() {
// Check on the VM, if expected values are there with dmidecode
res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(sudo dmidecode -s system-family | tr -s ' ') = KubeVirt ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "[ $(sudo dmidecode -s system-product-name | tr -s ' ') = None ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "[ $(sudo dmidecode -s system-manufacturer | tr -s ' ') = KubeVirt ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
}, 1*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -2457,11 +2457,11 @@ var _ = Describe("Configurations", func() {
// Check on the VM, if expected values are there with dmidecode
res, err := tests.ExpectBatchWithValidatedSend(expecter, []expect.Batcher{
&expect.BSnd{S: "[ $(sudo dmidecode -s system-family | tr -s ' ') = test ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "[ $(sudo dmidecode -s system-product-name | tr -s ' ') = test ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
&expect.BSnd{S: "[ $(sudo dmidecode -s system-manufacturer | tr -s ' ') = None ] && echo 'pass'\n"},
&expect.BExp{R: tests.RetValue("pass", "\\# ")},
&expect.BExp{R: tests.RetValue("pass")},
}, 1*time.Second)
log.DefaultLogger().Object(vmi).Infof("%v", res)
Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion tests/vmi_gpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func checkGPUDevice(vmi *v1.VirtualMachineInstance, gpuName string, prompt strin
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred(), "GPU device %q was not found in the VMI %s within the given timeout", gpuName, vmi.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/vmi_monitoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("Health Monitoring", func() {
&expect.BSnd{S: "watchdog -t 2000ms -T 4000ms /dev/watchdog && sleep 5 && killall -9 watchdog\n"},
&expect.BExp{R: "\\#"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
}, 250*time.Second)
Expect(err).ToNot(HaveOccurred())

Expand Down
10 changes: 5 additions & 5 deletions tests/vmi_multus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var _ = Describe("Multus", func() {
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: "\\$ "},
&expect.BSnd{S: "ip addr show eth1 | grep 10.1.1 | wc -l\n"},
&expect.BExp{R: tests.RetValue("1", "\\$ ")},
&expect.BExp{R: tests.RetValue("1")},
}, 15)
Expect(err).ToNot(HaveOccurred())

Expand Down Expand Up @@ -892,7 +892,7 @@ func configInterface(vmi *v1.VirtualMachineInstance, interfaceName, interfaceAdd
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred(), "Failed to configure address %s for interface %s on VMI %s", interfaceAddress, interfaceName, vmi.Name)

Expand All @@ -903,7 +903,7 @@ func configInterface(vmi *v1.VirtualMachineInstance, interfaceName, interfaceAdd
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred(), "Failed to set interface %s up on VMI %s", interfaceName, vmi.Name)
}
Expand All @@ -916,7 +916,7 @@ func checkInterface(vmi *v1.VirtualMachineInstance, interfaceName, prompt string
&expect.BSnd{S: cmdCheck},
&expect.BExp{R: prompt},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", prompt)},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred(), "Interface %q was not found in the VMI %s within the given timeout", interfaceName, vmi.Name)
}
Expand All @@ -930,7 +930,7 @@ func checkMacAddress(vmi *v1.VirtualMachineInstance, interfaceName, macAddress s
&expect.BExp{R: macAddress},
&expect.BExp{R: "#"},
&expect.BSnd{S: "echo $?\n"},
&expect.BExp{R: tests.RetValue("0", "\\#")},
&expect.BExp{R: tests.RetValue("0")},
}, 15)
Expect(err).ToNot(HaveOccurred(), "MAC %q was not found in the VMI %s within the given timeout", macAddress, vmi.Name)
}
Expand Down
Loading

0 comments on commit 3a69a73

Please sign in to comment.