mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix smoke tests due to change in behavior of restore VM (#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
This commit is contained in:
parent
55c8138a1a
commit
07f4fc2e51
@ -20,10 +20,6 @@ import json
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
@ -165,6 +161,7 @@ class TestEventsResource(cloudstackTestCase):
|
||||
self.cleanup.remove(volume)
|
||||
ts = str(time.time())
|
||||
virtual_machine.update(self.apiclient, displayname=ts)
|
||||
virtual_machine.start(self.apiclient)
|
||||
virtual_machine.delete(self.apiclient)
|
||||
self.cleanup.remove(virtual_machine)
|
||||
account_network.update(self.apiclient, name=account_network.name + ts)
|
||||
|
||||
@ -733,12 +733,17 @@ class TestNetworkPermissions(cloudstackTestCase):
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=True)
|
||||
|
||||
# 22. Destroy vm2, should succeed by vm owner
|
||||
# 22. Start VM before destroying, to recreate ROOT volume that was deleted as part of restore operation
|
||||
command = """self.virtual_machine.start({apiclient})"""
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=True)
|
||||
|
||||
# 23. Destroy vm2, should succeed by vm owner
|
||||
command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=True)
|
||||
|
||||
# 23. Recover vm2, should succeed by vm owner
|
||||
# 24. Recover vm2, should succeed by vm owner
|
||||
allow_expunge_recover_vm = Configurations.list(self.apiclient, name="allow.user.expunge.recover.vm")[0].value
|
||||
self.logger.debug("Global configuration allow.user.expunge.recover.vm = %s", allow_expunge_recover_vm)
|
||||
if allow_expunge_recover_vm == "true":
|
||||
@ -746,12 +751,12 @@ class TestNetworkPermissions(cloudstackTestCase):
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=True)
|
||||
|
||||
# 24. Destroy vm2, should succeed by vm owner
|
||||
# 25. Destroy vm2, should succeed by vm owner
|
||||
command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=True)
|
||||
|
||||
# 25. Expunge vm2, should succeed by vm owner
|
||||
# 26. Expunge vm2, should succeed by vm owner
|
||||
if allow_expunge_recover_vm == "true":
|
||||
command = """self.virtual_machine.expunge({apiclient})"""
|
||||
self.exec_command("self.user_apiclient", command, expected=False)
|
||||
@ -759,7 +764,7 @@ class TestNetworkPermissions(cloudstackTestCase):
|
||||
else:
|
||||
self.virtual_machine.expunge(self.apiclient)
|
||||
|
||||
# 26. Reset network permissions, should succeed by network owner
|
||||
# 27. Reset network permissions, should succeed by network owner
|
||||
command = """self.reset_network_permission({apiclient}, self.user_network, expected=True)"""
|
||||
self.exec_command("self.otheruser_apiclient", command, expected=False)
|
||||
self.exec_command("self.user_apiclient", command, expected=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user