Skip to content

Commit

Permalink
Update with review request part1
Browse files Browse the repository at this point in the history
  • Loading branch information
TachunLin committed Sep 12, 2024
1 parent 206612a commit 435a78b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions harvester_e2e_tests/integrations/test_4_vm_backup_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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
Expand All @@ -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}"
)
Expand Down Expand Up @@ -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
Expand All @@ -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}"
)
Expand Down

0 comments on commit 435a78b

Please sign in to comment.