From 88cf218b9b0f950bffd1e920da33f0f875df0ffa Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 9 Jun 2026 17:55:45 +0200 Subject: [PATCH 1/8] STD: init Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero.py | 68 +++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/data_protection/oadp/test_velero.py b/tests/data_protection/oadp/test_velero.py index 31f028984c..0dedf9c9c2 100644 --- a/tests/data_protection/oadp/test_velero.py +++ b/tests/data_protection/oadp/test_velero.py @@ -154,3 +154,71 @@ def test_restore_uploaded_dv( velero_restore_second_namespace_with_datamover, ): wait_for_restored_dv(dv=uploaded_rhel_dv) + + +class TestVeleroBackupHookOptOut: + """ + Tests for Velero backup hook opt-out with paused VMs and full backup/restore. + + STP: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/pull/116 + + Preconditions: + - OADP operator installed and configured + - Velero configured with default backup storage location + - VM with opt-out annotation deployed and running + """ + + __test__ = False + + @pytest.mark.polarion("CNV-16267") + def test_backup_paused_vm_hooks_disabled(self): + """ + Test that Velero backup of a paused VM completes with hooks disabled. + + Preconditions: + - VM deployed with kubevirt.io/skip-backup-hooks: "true" + - VM paused via virtctl + + Steps: + 1. Run Velero backup targeting the VM namespace + 2. Wait for backup completion + + Expected: + - Backup completes successfully without freeze/unfreeze hook execution + """ + + @pytest.mark.polarion("CNV-16268") + def test_full_backup_restore_hooks_disabled(self): + """ + Test that full Velero backup and restore completes with hooks disabled. + + Preconditions: + - VM deployed with kubevirt.io/skip-backup-hooks: "true" + - Test data written to VM disk + + Steps: + 1. Run Velero backup targeting the VM namespace + 2. Delete the VM and its namespace + 3. Restore from backup + 4. Wait for VM to reach Running state + + Expected: + - VM is restored in Running state with test data intact + """ + + @pytest.mark.polarion("CNV-16269") + def test_backup_paused_vm_default_hooks(self): + """ + Test that Velero backup of a paused VM attempts hooks by default. + + Preconditions: + - VM deployed without opt-out annotation + - VM paused via virtctl + + Steps: + 1. Run Velero backup targeting the VM namespace + 2. Wait for backup completion + + Expected: + - Backup completes with freeze/unfreeze hooks attempted + """ From 25d3ea31cb930ab9aeb7a6f6264bc5663e54c61a Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 16 Jun 2026 09:08:57 +0200 Subject: [PATCH 2/8] STD for velero_backup_hooks Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero.py | 68 ----------------- .../oadp/test_velero_backup_hooks.py | 74 +++++++++++++++++++ 2 files changed, 74 insertions(+), 68 deletions(-) create mode 100644 tests/data_protection/oadp/test_velero_backup_hooks.py diff --git a/tests/data_protection/oadp/test_velero.py b/tests/data_protection/oadp/test_velero.py index 0dedf9c9c2..31f028984c 100644 --- a/tests/data_protection/oadp/test_velero.py +++ b/tests/data_protection/oadp/test_velero.py @@ -154,71 +154,3 @@ def test_restore_uploaded_dv( velero_restore_second_namespace_with_datamover, ): wait_for_restored_dv(dv=uploaded_rhel_dv) - - -class TestVeleroBackupHookOptOut: - """ - Tests for Velero backup hook opt-out with paused VMs and full backup/restore. - - STP: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/pull/116 - - Preconditions: - - OADP operator installed and configured - - Velero configured with default backup storage location - - VM with opt-out annotation deployed and running - """ - - __test__ = False - - @pytest.mark.polarion("CNV-16267") - def test_backup_paused_vm_hooks_disabled(self): - """ - Test that Velero backup of a paused VM completes with hooks disabled. - - Preconditions: - - VM deployed with kubevirt.io/skip-backup-hooks: "true" - - VM paused via virtctl - - Steps: - 1. Run Velero backup targeting the VM namespace - 2. Wait for backup completion - - Expected: - - Backup completes successfully without freeze/unfreeze hook execution - """ - - @pytest.mark.polarion("CNV-16268") - def test_full_backup_restore_hooks_disabled(self): - """ - Test that full Velero backup and restore completes with hooks disabled. - - Preconditions: - - VM deployed with kubevirt.io/skip-backup-hooks: "true" - - Test data written to VM disk - - Steps: - 1. Run Velero backup targeting the VM namespace - 2. Delete the VM and its namespace - 3. Restore from backup - 4. Wait for VM to reach Running state - - Expected: - - VM is restored in Running state with test data intact - """ - - @pytest.mark.polarion("CNV-16269") - def test_backup_paused_vm_default_hooks(self): - """ - Test that Velero backup of a paused VM attempts hooks by default. - - Preconditions: - - VM deployed without opt-out annotation - - VM paused via virtctl - - Steps: - 1. Run Velero backup targeting the VM namespace - 2. Wait for backup completion - - Expected: - - Backup completes with freeze/unfreeze hooks attempted - """ diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py new file mode 100644 index 0000000000..7a417366e7 --- /dev/null +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -0,0 +1,74 @@ +""" +Velero Backup Hook Opt-Out Tests + +STP Reference: +Jira: CNV-79727 +""" + +import pytest + + +class TestVeleroBackupHookOptOut: + """ + Tests for Velero backup hook opt-out with paused VMs and full backup/restore. + + STP: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/pull/116 + + Preconditions: + - OADP operator installed and configured + - Velero configured with default backup storage location + """ + + __test__ = False + + @pytest.mark.polarion("CNV-16267") + def test_backup_paused_vm_hooks_disabled(self): + """ + Test that Velero backup of a paused VM completes with hooks disabled. + + Preconditions: + - VM deployed with kubevirt.io/skip-backup-hooks: "true" + + Steps: + 1. Pause the running VM + 2. Run Velero backup targeting the VM namespace + 3. Check Velero backup logs for hook execution entries + + Expected: + - Backup logs do not contain freeze/unfreeze hook entries + """ + + @pytest.mark.polarion("CNV-16268") + def test_full_backup_restore_hooks_disabled(self): + """ + Test that full Velero backup and restore completes with hooks disabled. + + Preconditions: + - Running VM deployed with kubevirt.io/skip-backup-hooks: "true" + + Steps: + 1. Run Velero backup targeting the VM namespace + 2. Delete the VM and its namespace + 3. Restore from backup + 4. Wait for VM to reach Running state + + Expected: + - VM is Running + """ + + @pytest.mark.polarion("CNV-16269") + def test_backup_paused_vm_default_hooks(self): + """ + Test that Velero backup of a paused VM attempts hooks by default. + + Preconditions: + - VM deployed without opt-out annotation + + Steps: + 1. Pause the running VM + 2. Run Velero backup targeting the VM namespace + 3. Check Velero backup logs for hook execution entries + + Expected: + - Backup logs contain freeze/unfreeze hook entries + """ From 9b40378c28757fa01747a0c01cae93dd96347295 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 16 Jun 2026 09:54:17 +0200 Subject: [PATCH 3/8] Removed log-parsing verification Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero_backup_hooks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index 7a417366e7..9045e373a9 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -32,10 +32,10 @@ def test_backup_paused_vm_hooks_disabled(self): Steps: 1. Pause the running VM 2. Run Velero backup targeting the VM namespace - 3. Check Velero backup logs for hook execution entries + 3. Wait for Velero backup to complete Expected: - - Backup logs do not contain freeze/unfreeze hook entries + - Backup completes with status Completed """ @pytest.mark.polarion("CNV-16268") @@ -67,8 +67,9 @@ def test_backup_paused_vm_default_hooks(self): Steps: 1. Pause the running VM 2. Run Velero backup targeting the VM namespace - 3. Check Velero backup logs for hook execution entries + 3. Wait for Velero backup to complete + 4. Check Velero backup logs for hook execution entries Expected: - - Backup logs contain freeze/unfreeze hook entries + - Backup completes with status Completed and backup logs contain freeze/unfreeze hook entries """ From 4ce502c77cd0242534ae1e3579ec90aa2ab36d42 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 16 Jun 2026 09:59:08 +0200 Subject: [PATCH 4/8] Refine expected outcomes for paused VM backup test in Velero hooks Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero_backup_hooks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index 9045e373a9..cab71c4288 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -71,5 +71,6 @@ def test_backup_paused_vm_default_hooks(self): 4. Check Velero backup logs for hook execution entries Expected: - - Backup completes with status Completed and backup logs contain freeze/unfreeze hook entries + - Backup completes with status Completed + - Backup logs contain freeze/unfreeze hook entries """ From 68dd34dd6161015fc130705f3e34e9afa9103d68 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 23 Jun 2026 12:36:09 +0200 Subject: [PATCH 5/8] Use quality-flow input STD Signed-off-by: Emanuele Prella --- .../oadp/test_velero_backup_hooks.py | 70 ++++++++----------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index cab71c4288..01f8f95a55 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -1,76 +1,62 @@ """ Velero Backup Hook Opt-Out Tests -STP Reference: -Jira: CNV-79727 +STP Reference: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/blob/main/stps/sig-storage/remove-velero-hooks-stp.md +Jira: https://redhat.atlassian.net/browse/CNV-79727 # """ import pytest -class TestVeleroBackupHookOptOut: +class TestVeleroHookOptOutPausedVM: """ - Tests for Velero backup hook opt-out with paused VMs and full backup/restore. - - STP: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/pull/116 + Tests for Velero backup hook opt-out on paused VMs. Preconditions: - - OADP operator installed and configured - - Velero configured with default backup storage location + - Running VM with per-VM opt-out annotation + - VM paused """ __test__ = False @pytest.mark.polarion("CNV-16267") - def test_backup_paused_vm_hooks_disabled(self): + def test_backup_succeeds_with_hooks_disabled_on_paused_vm(self): """ - Test that Velero backup of a paused VM completes with hooks disabled. - - Preconditions: - - VM deployed with kubevirt.io/skip-backup-hooks: "true" + Test that backup completes without hooks on a paused VM with opt-out. Steps: - 1. Pause the running VM - 2. Run Velero backup targeting the VM namespace - 3. Wait for Velero backup to complete + 1. Run Velero backup targeting the VM namespace + 2. Wait for backup to complete Expected: - Backup completes with status Completed + - No freeze/unfreeze hooks executed during backup """ - @pytest.mark.polarion("CNV-16268") - def test_full_backup_restore_hooks_disabled(self): - """ - Test that full Velero backup and restore completes with hooks disabled. - Preconditions: - - Running VM deployed with kubevirt.io/skip-backup-hooks: "true" +class TestVeleroHookOptOutBackupRestore: + """ + Tests for full Velero backup and restore with hook opt-out. - Steps: - 1. Run Velero backup targeting the VM namespace - 2. Delete the VM and its namespace - 3. Restore from backup - 4. Wait for VM to reach Running state + Preconditions: + - Running VM with per-VM opt-out annotation disabling backup hooks + """ - Expected: - - VM is Running - """ + __test__ = False - @pytest.mark.polarion("CNV-16269") - def test_backup_paused_vm_default_hooks(self): + @pytest.mark.polarion("CNV-16268") + def test_full_backup_restore_with_hooks_disabled(self): """ - Test that Velero backup of a paused VM attempts hooks by default. - - Preconditions: - - VM deployed without opt-out annotation + Test that full backup and restore workflow completes with hooks disabled. Steps: - 1. Pause the running VM - 2. Run Velero backup targeting the VM namespace - 3. Wait for Velero backup to complete - 4. Check Velero backup logs for hook execution entries + 1. Run Velero backup + 2. Delete VM and namespace + 3. Restore from backup + 4. Wait for restore to complete Expected: - - Backup completes with status Completed - - Backup logs contain freeze/unfreeze hook entries + - Backup completes successfully without hooks + - Restore completes successfully + - VM is running after restore """ From d586d8232caaaf0dbe0b95cf11b8f2064783bfbb Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Tue, 23 Jun 2026 18:35:02 +0200 Subject: [PATCH 6/8] "STP Reference" -> "STP" Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero_backup_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index 01f8f95a55..7d12ce12fa 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -1,7 +1,7 @@ """ Velero Backup Hook Opt-Out Tests -STP Reference: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/blob/main/stps/sig-storage/remove-velero-hooks-stp.md +STP: https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/blob/main/stps/sig-storage/remove-velero-hooks-stp.md Jira: https://redhat.atlassian.net/browse/CNV-79727 # """ From c74b13bc850c12b05a45794064463fe7ef3f2936 Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Wed, 24 Jun 2026 10:23:29 +0200 Subject: [PATCH 7/8] QualityFlow: 2nd iteration Signed-off-by: Emanuele Prella --- .../oadp/test_velero_backup_hooks.py | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index 7d12ce12fa..25e2963608 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -8,55 +8,44 @@ import pytest -class TestVeleroHookOptOutPausedVM: +class TestVeleroBackupHookOptOut: """ - Tests for Velero backup hook opt-out on paused VMs. + Tests for Velero backup hook opt-out with backup/restore operations. Preconditions: - - Running VM with per-VM opt-out annotation - - VM paused + - VM with backup hooks disabled """ __test__ = False @pytest.mark.polarion("CNV-16267") - def test_backup_succeeds_with_hooks_disabled_on_paused_vm(self): + def test_backup_paused_vm_hooks_disabled(self): """ - Test that backup completes without hooks on a paused VM with opt-out. + Test that backup of paused VM completes with hooks disabled. + + Preconditions: + - VM with backup hooks disabled, paused Steps: - 1. Run Velero backup targeting the VM namespace - 2. Wait for backup to complete + Run Velero backup Expected: - - Backup completes with status Completed - - No freeze/unfreeze hooks executed during backup + Backup completes successfully without freeze/unfreeze hook execution """ - -class TestVeleroHookOptOutBackupRestore: - """ - Tests for full Velero backup and restore with hook opt-out. - - Preconditions: - - Running VM with per-VM opt-out annotation disabling backup hooks - """ - - __test__ = False - @pytest.mark.polarion("CNV-16268") - def test_full_backup_restore_with_hooks_disabled(self): + def test_full_backup_restore_hooks_disabled(self): """ - Test that full backup and restore workflow completes with hooks disabled. + Test that full backup/restore cycle completes with hooks disabled. + + Preconditions: + - Running VM with backup hooks disabled Steps: 1. Run Velero backup 2. Delete VM and namespace 3. Restore from backup - 4. Wait for restore to complete Expected: - - Backup completes successfully without hooks - - Restore completes successfully - - VM is running after restore + VM is restored and running after backup/restore cycle """ From 9953da05b44b806ec57b6f4e74ec4a316b19d25a Mon Sep 17 00:00:00 2001 From: Emanuele Prella Date: Wed, 24 Jun 2026 10:29:35 +0200 Subject: [PATCH 8/8] Add numbered step format Signed-off-by: Emanuele Prella --- tests/data_protection/oadp/test_velero_backup_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data_protection/oadp/test_velero_backup_hooks.py b/tests/data_protection/oadp/test_velero_backup_hooks.py index 25e2963608..4ad143d986 100644 --- a/tests/data_protection/oadp/test_velero_backup_hooks.py +++ b/tests/data_protection/oadp/test_velero_backup_hooks.py @@ -27,7 +27,7 @@ def test_backup_paused_vm_hooks_disabled(self): - VM with backup hooks disabled, paused Steps: - Run Velero backup + 1. Run Velero backup Expected: Backup completes successfully without freeze/unfreeze hook execution