Skip to content

Commit 439ee92

Browse files
Pearl1594dhslove
authored andcommitted
Fix smoke tests due to change in behavior of restore VM (apache#10583)
* Fix unit tests due to change in behavior of restore VM * update numbering in comments * revert delete operations * fix placement of start vm after refactoring
1 parent cc12ac8 commit 439ee92

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

test/integration/smoke/test_events_resource.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
import os
2121
import tempfile
2222
import time
23-
import unittest
24-
import urllib.error
25-
import urllib.parse
26-
import urllib.request
2723

2824
from datetime import datetime
2925

@@ -165,6 +161,7 @@ def test_01_events_resource(self):
165161
self.cleanup.remove(volume)
166162
ts = str(time.time())
167163
virtual_machine.update(self.apiclient, displayname=ts)
164+
virtual_machine.start(self.apiclient)
168165
virtual_machine.delete(self.apiclient)
169166
self.cleanup.remove(virtual_machine)
170167
account_network.update(self.apiclient, name=account_network.name + ts)

test/integration/smoke/test_network_permissions.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,33 +733,38 @@ def test_04_deploy_vm_for_other_user_and_test_vm_operations(self):
733733
self.exec_command("self.user_apiclient", command, expected=False)
734734
self.exec_command("self.otheruser_apiclient", command, expected=True)
735735

736-
# 22. Destroy vm2, should succeed by vm owner
736+
# 22. Start VM before destroying, to recreate ROOT volume that was deleted as part of restore operation
737+
command = """self.virtual_machine.start({apiclient})"""
738+
self.exec_command("self.user_apiclient", command, expected=False)
739+
self.exec_command("self.otheruser_apiclient", command, expected=True)
740+
741+
# 23. Destroy vm2, should succeed by vm owner
737742
command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
738743
self.exec_command("self.user_apiclient", command, expected=False)
739744
self.exec_command("self.otheruser_apiclient", command, expected=True)
740745

741-
# 23. Recover vm2, should succeed by vm owner
746+
# 24. Recover vm2, should succeed by vm owner
742747
allow_expunge_recover_vm = Configurations.list(self.apiclient, name="allow.user.expunge.recover.vm")[0].value
743748
self.logger.debug("Global configuration allow.user.expunge.recover.vm = %s", allow_expunge_recover_vm)
744749
if allow_expunge_recover_vm == "true":
745750
command = """self.virtual_machine.recover({apiclient})"""
746751
self.exec_command("self.user_apiclient", command, expected=False)
747752
self.exec_command("self.otheruser_apiclient", command, expected=True)
748753

749-
# 24. Destroy vm2, should succeed by vm owner
754+
# 25. Destroy vm2, should succeed by vm owner
750755
command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
751756
self.exec_command("self.user_apiclient", command, expected=False)
752757
self.exec_command("self.otheruser_apiclient", command, expected=True)
753758

754-
# 25. Expunge vm2, should succeed by vm owner
759+
# 26. Expunge vm2, should succeed by vm owner
755760
if allow_expunge_recover_vm == "true":
756761
command = """self.virtual_machine.expunge({apiclient})"""
757762
self.exec_command("self.user_apiclient", command, expected=False)
758763
self.exec_command("self.otheruser_apiclient", command, expected=True)
759764
else:
760765
self.virtual_machine.expunge(self.apiclient)
761766

762-
# 26. Reset network permissions, should succeed by network owner
767+
# 27. Reset network permissions, should succeed by network owner
763768
command = """self.reset_network_permission({apiclient}, self.user_network, expected=True)"""
764769
self.exec_command("self.otheruser_apiclient", command, expected=False)
765770
self.exec_command("self.user_apiclient", command, expected=True)

0 commit comments

Comments
 (0)