Skip to content

Commit

Permalink
Fix Jenkins job execution failure
Browse files Browse the repository at this point in the history
  • Loading branch information
TachunLin committed Sep 12, 2024
1 parent 5577c19 commit 206612a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions harvester_e2e_tests/integrations/test_4_vm_backup_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def test_with_snapshot_restore_with_new_vm(
pub_key, pri_key = ssh_keypair

vm_snapshot_name = unique_vm_name + '-snapshot'
# unique_backup_name = f"{unique_vm_name}-backup-with-snapshot"

# take vm snapshot
code, data = api_client.vm_snapshots.create(unique_vm_name, vm_snapshot_name)
assert 201 == code
Expand Down Expand Up @@ -695,6 +695,8 @@ def test_with_snapshot_restore_with_new_vm(
spec = api_client.backups.RestoreSpec.for_new(restored_vm_name)
code, data = api_client.backups.restore(unique_vm_name, spec)
assert 201 == code, (code, data)
vm_getable, (code, data) = vm_checker.wait_getable(restored_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(restored_vm_name, ['default'])
Expand All @@ -708,6 +710,7 @@ def test_with_snapshot_restore_with_new_vm(
code, data = api_client.hosts.get(data['status']['nodeName'])
host_ip = next(addr['address'] for addr in data['status']['addresses']
if addr['type'] == 'InternalIP')
base_vm_with_data['host_ip'], base_vm_with_data['vm_ip'] = host_ip, vm_ip

# Login to the new VM and check data is existing
with vm_shell_from_host(host_ip, vm_ip, base_vm_with_data['ssh_user'], pkey=pri_key) as sh:
Expand Down Expand Up @@ -759,7 +762,7 @@ def test_with_snapshot_restore_replace_retain_vols(
pub_key, pri_key = ssh_keypair

vm_snapshot_name = unique_vm_name + '-snapshot-retain'
# unique_backup_name = f"{unique_vm_name}-backup-with-snapshot"

# take vm snapshot
code, data = api_client.vm_snapshots.create(unique_vm_name, vm_snapshot_name)
assert 201 == code
Expand Down Expand Up @@ -817,6 +820,12 @@ def test_with_snapshot_restore_replace_retain_vols(
code, data = api_client.backups.restore(unique_vm_name, spec)
assert 201 == code, f'Failed to restore backup with current VM replaced, {data}'

vm_running, (code, data) = vm_checker.wait_status_running(unique_vm_name)
assert vm_running, (
f"Failed to restore VM({unique_vm_name}) with errors:\n"
f"Status({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'])
assert vm_got_ips, (
Expand Down

0 comments on commit 206612a

Please sign in to comment.