migration_test: add a test for virtctl migrate-cancel
It's an existing test but cancelling the migration using virtctl
@@ -259,7 +259,8 @@ var _ = Describe("[Serial][rfe_id:393][crit:high][vendor:cnv-qe@redhat.com][leve
Expect(virtClient.VirtualMachineInstanceMigration(migration.Namespace).Delete(migration.Name, &metav1.DeleteOptions{})).To(Succeed(), "Migration should be deleted successfully")
return migration
}
- runAndImmediatelyCancelMigration := func(migration *v1.VirtualMachineInstanceMigration, vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstanceMigration {
+
+ runAndImmediatelyCancelMigration := func(migration *v1.VirtualMachineInstanceMigration, vmi *v1.VirtualMachineInstance, with_virtctl bool, timeout int) *v1.VirtualMachineInstanceMigration {
By("Starting a Migration")
Eventually(func() error {
migration, err = virtClient.VirtualMachineInstanceMigration(migration.Namespace).Create(migration, &metav1.CreateOptions{})
@@ -275,8 +276,15 @@ var _ = Describe("[Serial][rfe_id:393][crit:high][vendor:cnv-qe@redhat.com][leve
}, timeout, 1*time.Second).Should(BeTrue())
+ if (!with_virtctl) {
By("Cancelling a Migration")
Expect(virtClient.VirtualMachineInstanceMigration(migration.Namespace).Delete(migration.Name, &metav1.DeleteOptions{})).To(Succeed(), "Migration should be deleted successfully")
+ } else {
+ By("Cancelling a Migration with virtctl")
+ command := tests.NewRepeatableVirtctlCommand("migrate-cancel", "--namespace", migration.Namespace, vmi.Name)
+ Expect(command()).To(Succeed(), "should successfully migrate-cancel a migration")
+ }
+
return migration
}
@@ -2192,7 +2200,8 @@ var _ = Describe("[Serial][rfe_id:393][crit:high][vendor:cnv-qe@redhat.com][leve
table.Entry("[sig-storage][test_id:2226] with ContainerDisk", newVirtualMachineInstanceWithFedoraContainerDisk),
table.Entry("[sig-storage][storage-req][test_id:2731] with RWX block disk from block volume PVC", newVirtualMachineInstanceWithFedoraRWXBlockDisk),
)
- It("[sig-compute][test_id:3241]should be able to cancel a migration right after posting it", func() {
+
+ table.DescribeTable("Immediate migration cancellation", func(with_virtctl bool) {
vmi := tests.NewRandomFedoraVMIWithGuestAgent()
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse(fedoraVMSize)
@@ -2206,7 +2215,7 @@ var _ = Describe("[Serial][rfe_id:393][crit:high][vendor:cnv-qe@redhat.com][leve
By("Starting the Migration")
migration := tests.NewRandomMigration(vmi.Name, vmi.Namespace)
- migration = runAndImmediatelyCancelMigration(migration, vmi, 180)
+ migration = runAndImmediatelyCancelMigration(migration, vmi, with_virtctl, 180)
// check VMI, confirm migration state
confirmVMIPostMigrationAborted(vmi, string(migration.UID), 180)
@@ -2220,8 +2229,10 @@ var _ = Describe("[Serial][rfe_id:393][crit:high][vendor:cnv-qe@redhat.com][leve
By("Waiting for VMI to disappear")
tests.WaitForVirtualMachineToDisappearWithTimeout(vmi, 240)
-
- })
+ },
+ table.Entry("[sig-compute][test_id:3241]cancel a migration right after posting it", false),
+ table.Entry("[sig-compute][test_id:3246]cancel a migration with virtctl", true),
+ )
})
Context("with a host-model cpu", func() {
