Skip to content

Commit 05a1e10

Browse files
test: fix powerstate (#2036)
Description Reduced ssh command timeout wait to 5 seconds. UntilSSHReady now wait 60 seconds in test PowerState. Why do we need it, and what problem does it solve? There was also only one attempt to connect to the server. SSH actually only knocked once, because the timeout for SSH is 30 seconds, and for Eventually it's also 30 seconds. --------- Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
1 parent 12d399c commit 05a1e10

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

test/e2e/internal/util/vm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func UntilSSHReady(f *framework.Framework, vm *v1alpha2.VirtualMachine, timeout
5959
GinkgoHelper()
6060

6161
Eventually(func(g Gomega) {
62-
result, err := f.SSHCommand(vm.Name, vm.Namespace, "echo 'test'")
62+
result, err := f.SSHCommand(vm.Name, vm.Namespace, "echo 'test'", framework.WithSSHTimeout(5*time.Second))
6363
g.Expect(err).NotTo(HaveOccurred())
6464
g.Expect(result).To(ContainSubstring("test"))
6565
}).WithTimeout(timeout).WithPolling(time.Second).Should(Succeed())

test/e2e/vm/power_state.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var _ = Describe("PowerState", func() {
7272

7373
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.LongTimeout, t.VM)
7474
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.MiddleTimeout, t.VMBDA)
75-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
75+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
7676
})
7777

7878
By("Shutdown VM by VMOP", func() {
@@ -101,7 +101,7 @@ var _ = Describe("PowerState", func() {
101101
util.StartVirtualMachine(f, t.VM)
102102
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.MiddleTimeout, t.VM)
103103
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
104-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
104+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
105105
}
106106
})
107107

@@ -118,7 +118,7 @@ var _ = Describe("PowerState", func() {
118118
util.UntilVirtualMachineRebooted(crclient.ObjectKeyFromObject(t.VM), runningLastTransitionTime, framework.LongTimeout)
119119
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.ShortTimeout, t.VM)
120120
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
121-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
121+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
122122
case v1alpha2.AlwaysOnUnlessStoppedManually, v1alpha2.ManualPolicy:
123123
util.UntilObjectPhase(string(v1alpha2.MachineStopped), framework.LongTimeout, t.VM)
124124
}
@@ -129,7 +129,7 @@ var _ = Describe("PowerState", func() {
129129
util.StartVirtualMachine(f, t.VM)
130130
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.MiddleTimeout, t.VM)
131131
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
132-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
132+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
133133
}
134134
})
135135

@@ -153,7 +153,7 @@ var _ = Describe("PowerState", func() {
153153
util.UntilVirtualMachineRebooted(crclient.ObjectKeyFromObject(t.VM), runningLastTransitionTime, framework.MiddleTimeout)
154154
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.ShortTimeout, t.VM)
155155
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
156-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
156+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
157157
})
158158

159159
By("Reboot VM by SSH", func() {
@@ -168,7 +168,7 @@ var _ = Describe("PowerState", func() {
168168
util.UntilVirtualMachineRebooted(crclient.ObjectKeyFromObject(t.VM), runningLastTransitionTime, framework.LongTimeout)
169169
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.ShortTimeout, t.VM)
170170
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
171-
util.UntilSSHReady(f, t.VM, framework.ShortTimeout)
171+
util.UntilSSHReady(f, t.VM, framework.MiddleTimeout)
172172
})
173173

174174
By("Check VM can reach external network", func() {

0 commit comments

Comments
 (0)