Skip to content

Commit 4fa833a

Browse files
authored
fix: wait for VM running after updating runStrategy to Always (RedHatQE#4272)
##### Short description: - Fix `test_run_strategy_pause_unpause_vmi` failure caused by fixture ordering change in RedHatQE#3847 - Add `running_vm()` call in `updated_vm_run_strategy` after setting the strategy to `Always`, ensuring the VM is fully running before returning. This centralizes the fix so all callers benefit. assisted-by: Gemini ##### More details: PR RedHatQE#3847 moved `start_vm_if_not_running` from function argument to `@pytest.mark.usefixtures`, which changed the fixture execution order. `start_vm_if_not_running` now runs **before** `request_updated_vm_run_strategy`, so when the strategy changes to `Always`, the VM is stopped and auto-restarts, but the test proceeds before the VM is ready, resulting in a 409 Conflict ("VM is not running") on pause. ##### What this PR does / why we need it: ##### Which issue(s) this PR fixes: ##### Special notes for reviewer: ##### jira-ticket: <!-- full-ticket-url needs to be provided. This would add a link to the pull request to the jira and close it when the pull request is merged If the task is not tracked by a Jira ticket, just write "NONE". --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Improved VM run-strategy tests to include an additional synchronization when setting the strategy to ALWAYS, verifying the VM reaches the running state. * Retained existing test behavior for other strategies, including verifying proper stop/start transitions where applicable. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Sibo Wang <siwang@redhat.com>
1 parent c3fdc06 commit 4fa833a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def updated_vm_run_strategy(run_strategy, vm_for_test):
102102
vm_for_test.stop(wait=True)
103103

104104
ResourceEditor(patches={vm_for_test: {"spec": {"runStrategy": run_strategy}}}).update()
105+
106+
if run_strategy == ALWAYS:
107+
vm_for_test.wait_for_specific_status(status=VirtualMachine.Status.RUNNING)
105108
return run_strategy
106109

107110

0 commit comments

Comments
 (0)