-
Notifications
You must be signed in to change notification settings - Fork 3
test: exclude power state checks from complex test #1841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
19e556f to
5435a88
Compare
5435a88 to
f37fa61
Compare
| func StopVirtualMachineFromOS(f *framework.Framework, vm *v1alpha2.VirtualMachine) { | ||
| GinkgoHelper() | ||
|
|
||
| _, err := f.SSHCommand(vm.Name, vm.Namespace, "nohup sh -c \"sleep 5 && sudo init 0\" > /dev/null 2>&1 &") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the solution does not work on Alpine OS. If this is a common solution, it should work on other operating systems.
| _, err := f.SSHCommand(vm.Name, vm.Namespace, "nohup sh -c \"sleep 5 && sudo init 0\" > /dev/null 2>&1 &") | ||
| Expect(err).To(SatisfyAny( | ||
| Not(HaveOccurred()), | ||
| MatchError(MatchError(ContainSubstring("unexpected EOF"))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this error expected here?
| _, err := f.SSHCommand(vm.Name, vm.Namespace, "nohup sh -c \"sleep 5 && sudo reboot\" > /dev/null 2>&1 &") | ||
| Expect(err).To(SatisfyAny( | ||
| Not(HaveOccurred()), | ||
| MatchError(MatchError(ContainSubstring("unexpected EOF"))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this error expected here?
| Expect(err).NotTo(HaveOccurred()) | ||
| } | ||
|
|
||
| func RebootVirtualMachineByPodDeletion(f *framework.Framework, vm *v1alpha2.VirtualMachine) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it work with length and indexes, instead of an active pod?
|
|
||
| opts := []vmopbuilder.Option{ | ||
| vmopbuilder.WithGenerateName("vmop-e2e-"), | ||
| vmopbuilder.WithGenerateName("vmop-start-"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be in the same style as reboot, with a prefix. You can create the prefix constants in one place.
| var namespaceName string | ||
| switch runPolicy { | ||
| case v1alpha2.AlwaysOnPolicy: | ||
| namespaceName = "power-aon" | ||
| case v1alpha2.AlwaysOnUnlessStoppedManually: | ||
| namespaceName = "power-aon-usm" | ||
| case v1alpha2.ManualPolicy: | ||
| namespaceName = "power-manual" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var namespaceName string | |
| switch runPolicy { | |
| case v1alpha2.AlwaysOnPolicy: | |
| namespaceName = "power-aon" | |
| case v1alpha2.AlwaysOnUnlessStoppedManually: | |
| namespaceName = "power-aon-usm" | |
| case v1alpha2.ManualPolicy: | |
| namespaceName = "power-manual" | |
| var namespaceSuffix string | |
| switch runPolicy { | |
| case v1alpha2.AlwaysOnPolicy: | |
| namespaceSuffix = "always-on" | |
| case v1alpha2.AlwaysOnUnlessStoppedManually: | |
| namespaceSuffix = "unless-stopped-manually" | |
| case v1alpha2.ManualPolicy: | |
| namespaceSuffix = "manual" |
|
|
||
| util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.LongTimeout, t.VM) | ||
| util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.MiddleTimeout, t.VMBDA) | ||
| util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.ShortTimeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary in this test case?
| t.VMOPStop = vmopbuilder.New( | ||
| vmopbuilder.WithGenerateName("vmop-stop-"), | ||
| vmopbuilder.WithNamespace(t.VM.Namespace), | ||
| vmopbuilder.WithType(v1alpha2.VMOPTypeStop), | ||
| vmopbuilder.WithVirtualMachine(t.VM.Name), | ||
| ) | ||
|
|
||
| t.VMOPStart = vmopbuilder.New( | ||
| vmopbuilder.WithGenerateName("vmop-start-"), | ||
| vmopbuilder.WithNamespace(t.VM.Namespace), | ||
| vmopbuilder.WithType(v1alpha2.VMOPTypeStart), | ||
| vmopbuilder.WithVirtualMachine(t.VM.Name), | ||
| ) | ||
|
|
||
| t.VMOPRestart = vmopbuilder.New( | ||
| vmopbuilder.WithGenerateName("vmop-restart-"), | ||
| vmopbuilder.WithNamespace(t.VM.Namespace), | ||
| vmopbuilder.WithType(v1alpha2.VMOPTypeRestart), | ||
| vmopbuilder.WithVirtualMachine(t.VM.Name), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use the functions from the util.go file?
| if t.VM.Spec.RunPolicy == v1alpha2.AlwaysOnPolicy { | ||
| return // No need to start VM if it's AlwaysOn policy | ||
| } | ||
|
|
||
| util.StartVirtualMachine(f, t.VM) | ||
| util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.MiddleTimeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if t.VM.Spec.RunPolicy == v1alpha2.AlwaysOnPolicy { | |
| return // No need to start VM if it's AlwaysOn policy | |
| } | |
| util.StartVirtualMachine(f, t.VM) | |
| util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.MiddleTimeout) | |
| if t.VM.Spec.RunPolicy != v1alpha2.AlwaysOnPolicy { | |
| util.StartVirtualMachine(f, t.VM) | |
| util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.ShortTimeout, t.VM) | |
| } |
| }) | ||
|
|
||
| By("Check VM can reach external network", func() { | ||
| network.CheckExternalConnectivity(f, t.VM.Name, network.ExternalHost, network.HTTPStatusOk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you excluding "CheckCiliumAgents"?
Description
Exclude power state checks from complex test. Write new e2e power state test.
Why do we need it, and what problem does it solve?
What is the expected result?
Checklist
Changelog entries