diff --git a/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists-always-on/kustomization.yaml b/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists-always-on/kustomization.yaml index 490f66c7eb..2df45b15b9 100644 --- a/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists-always-on/kustomization.yaml +++ b/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists-always-on/kustomization.yaml @@ -11,3 +11,10 @@ patches: target: kind: VirtualMachine name: vm + - patch: |- + - op: replace + path: /spec/disruptions/restartApprovalMode + value: Automatic + target: + kind: VirtualMachine + name: vm diff --git a/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists/kustomization.yaml b/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists/kustomization.yaml index 65e9e972af..2807486658 100644 --- a/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists/kustomization.yaml +++ b/tests/e2e/testdata/vm-restore-force/vm/overlays/vm-exists/kustomization.yaml @@ -3,3 +3,11 @@ kind: Kustomization nameSuffix: -restore-force resources: - ../../base +patches: + - patch: |- + - op: replace + path: /spec/disruptions/restartApprovalMode + value: Automatic + target: + kind: VirtualMachine + name: vm diff --git a/tests/e2e/testdata/vm-restore-safe/vm/overlays/vm/kustomization.yaml b/tests/e2e/testdata/vm-restore-safe/vm/overlays/vm/kustomization.yaml index 779c7e5d78..0b5ef3d497 100644 --- a/tests/e2e/testdata/vm-restore-safe/vm/overlays/vm/kustomization.yaml +++ b/tests/e2e/testdata/vm-restore-safe/vm/overlays/vm/kustomization.yaml @@ -3,3 +3,11 @@ kind: Kustomization nameSuffix: -restore-safe resources: - ../../base +patches: + - patch: |- + - op: replace + path: /spec/disruptions/restartApprovalMode + value: Automatic + target: + kind: VirtualMachine + name: vm diff --git a/tests/e2e/util_test.go b/tests/e2e/util_test.go index e52768c980..90c0b6ad4f 100644 --- a/tests/e2e/util_test.go +++ b/tests/e2e/util_test.go @@ -756,6 +756,7 @@ func SaveTestCaseDump(labels map[string]string, additional, namespace string) { SaveTestCaseResources(labels, additional, namespace, tmpDir) SavePodLogsAndDescriptions(labels, additional, namespace, tmpDir) + SaveIntvirtvmDescriptions(labels, additional, namespace, tmpDir) } func SaveTestCaseResources(labels map[string]string, additional, namespace, dumpPath string) { @@ -825,6 +826,19 @@ func SavePodLogsAndDescriptions(labels map[string]string, additional, namespace, } } +func SaveIntvirtvmDescriptions(labels map[string]string, additional, namespace, dumpPath string) { + describeCmd := kubectl.RawCommand(fmt.Sprintf("describe intvirtvm --namespace %s", namespace), framework.ShortTimeout) + if describeCmd.Error() != nil { + GinkgoWriter.Printf("Failed to describe InternalVirtualizationVirtualMachine:\nError: %s\n", describeCmd.StdErr()) + } + + fileName := fmt.Sprintf("%s/e2e_failed__%s__%s__intvirtvm_describe", dumpPath, labels["testcase"], additional) + err := os.WriteFile(fileName, describeCmd.StdOutBytes(), 0o644) + if err != nil { + GinkgoWriter.Printf("Failed to save InternalVirtualizationVirtualMachine description:\nError: %s\n", err) + } +} + type Watcher interface { Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) } diff --git a/tests/e2e/vm_restore_force_test.go b/tests/e2e/vm_restore_force_test.go index bab2d3cdae..a7b31734d1 100644 --- a/tests/e2e/vm_restore_force_test.go +++ b/tests/e2e/vm_restore_force_test.go @@ -149,6 +149,8 @@ var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), framework.Commo patchRes := kubectl.RawCommand(cmd, ShortWaitDuration) Expect(patchRes.Error()).NotTo(HaveOccurred(), patchRes.StdErr()) + // TODO: Remove manual restart when the VM restart issue is fixed. + // This manual restart is only needed for tracking the problem and should be removed from the test in the future. RebootVirtualMachinesByVMOP(testCaseLabel, namespace, vmNames...) })