From 435a78bd1fdf8cae617c3237db145adc1bb41030 Mon Sep 17 00:00:00 2001 From: davidtclin Date: Thu, 12 Sep 2024 23:57:54 +0800 Subject: [PATCH] Update with review request part1 --- .../integrations/test_4_vm_backup_restore.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/harvester_e2e_tests/integrations/test_4_vm_backup_restore.py b/harvester_e2e_tests/integrations/test_4_vm_backup_restore.py index f7824e50a..cb4532719 100644 --- a/harvester_e2e_tests/integrations/test_4_vm_backup_restore.py +++ b/harvester_e2e_tests/integrations/test_4_vm_backup_restore.py @@ -605,6 +605,8 @@ def test_restore_replace_with_vm_shutdown_command( spec = api_client.backups.RestoreSpec.for_existing(delete_volumes=True) code, data = api_client.backups.restore(unique_vm_name, spec) assert 201 == code, f'Failed to restore backup with current VM replaced, {data}' + vm_getable, (code, data) = vm_checker.wait_getable(unique_vm_name) + assert vm_getable, (code, data) # Check VM Started then get IPs (vm and host) vm_got_ips, (code, data) = vm_checker.wait_ip_addresses(unique_vm_name, ['default']) @@ -656,7 +658,10 @@ def test_with_snapshot_restore_with_new_vm( print(f"waiting for {vm_snapshot_name} to be ready") sleep(3) else: - raise AssertionError(f"timed out waiting for {vm_snapshot_name} to be ready") + raise AssertionError( + f"timed out waiting for {vm_snapshot_name} to be ready:\n" + f"Status({code}): {data}" + ) assert 200 == code assert data.get("status", {}).get("readyToUse") is True @@ -667,10 +672,10 @@ def test_with_snapshot_restore_with_new_vm( f"Status({code}): {data}" ) - # Check VM Started then get IPs (vm and host) + # Check VM is still running and can get IPs (vm and host) vm_got_ips, (code, data) = vm_checker.wait_ip_addresses(unique_vm_name, ['default']) assert vm_got_ips, ( - f"Failed to Start VM({unique_vm_name}) with errors:\n" + f"Failed to check the VM({unique_vm_name}) is sill in running state:\n" f"Status: {data.get('status')}\n" f"API Status({code}): {data}" ) @@ -775,7 +780,10 @@ def test_with_snapshot_restore_replace_retain_vols( print(f"waiting for {vm_snapshot_name} to be ready") sleep(3) else: - raise AssertionError(f"timed out waiting for {vm_snapshot_name} to be ready") + raise AssertionError( + f"timed out waiting for {vm_snapshot_name} to be ready:\n" + f"Status({code}): {data}" + ) assert 200 == code assert data.get("status", {}).get("readyToUse") is True @@ -786,10 +794,10 @@ def test_with_snapshot_restore_replace_retain_vols( f"Status({code}): {data}" ) - # Check VM Started then get IPs (vm and host) + # Check VM is still running and can get IPs (vm and host) vm_got_ips, (code, data) = vm_checker.wait_ip_addresses(unique_vm_name, ['default']) assert vm_got_ips, ( - f"Failed to Start VM({unique_vm_name}) with errors:\n" + f"Failed to check the VM({unique_vm_name}) is sill in running state:\n" f"Status: {data.get('status')}\n" f"API Status({code}): {data}" )