mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixing the vm_life_cycle expunge test
* expunge.interval determines the ExpungeTask interval to cleanup the VM and post expunge.delay seconds we delete the VM entry. So let's just wait long enough
This commit is contained in:
parent
ecfdb3af5c
commit
0119e6d04e
@ -107,7 +107,7 @@ class Services:
|
||||
"name": "testISO",
|
||||
"url": "http://nfs1.lab.vmops.com/isos_32bit/dsl-4.4.10.iso",
|
||||
# Source URL where ISO is located
|
||||
"ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e',
|
||||
"ostypeid": '93ffa3ea-ef02-4e56-9940-f04158353555',
|
||||
"mode": 'HTTP_DOWNLOAD', # Downloading existing ISO
|
||||
},
|
||||
"template": {
|
||||
@ -121,7 +121,7 @@ class Services:
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
#Migrate VM to hostid
|
||||
"ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e',
|
||||
"ostypeid": '93ffa3ea-ef02-4e56-9940-f04158353555',
|
||||
# CentOS 5.3 (64-bit)
|
||||
"mode":'advanced',
|
||||
}
|
||||
@ -168,6 +168,7 @@ class TestDeployVM(cloudstackTestCase):
|
||||
self.account
|
||||
]
|
||||
|
||||
|
||||
def test_deploy_vm(self):
|
||||
"""Test Deploy Virtual Machine
|
||||
"""
|
||||
@ -315,6 +316,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
return
|
||||
|
||||
|
||||
def test_01_stop_vm(self):
|
||||
"""Test Stop Virtual Machine
|
||||
"""
|
||||
@ -350,6 +352,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_02_start_vm(self):
|
||||
"""Test Start Virtual Machine
|
||||
"""
|
||||
@ -387,6 +390,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_03_reboot_vm(self):
|
||||
"""Test Reboot Virtual Machine
|
||||
"""
|
||||
@ -422,6 +426,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_04_change_offering_small(self):
|
||||
"""Change Offering to a small capacity
|
||||
"""
|
||||
@ -539,6 +544,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_05_change_offering_medium(self):
|
||||
"""Change Offering to a medium capacity
|
||||
"""
|
||||
@ -660,6 +666,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_06_destroy_vm(self):
|
||||
"""Test destroy Virtual Machine
|
||||
"""
|
||||
@ -695,6 +702,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_07_restore_vm(self):
|
||||
"""Test recover Virtual Machine
|
||||
"""
|
||||
@ -734,6 +742,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
|
||||
return
|
||||
|
||||
|
||||
def test_08_migrate_vm(self):
|
||||
"""Test migrate VM
|
||||
"""
|
||||
@ -825,10 +834,25 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
# Wait for some time more than expunge.delay
|
||||
time.sleep(int(response.value) * 2)
|
||||
|
||||
list_vm_response = list_virtual_machines(
|
||||
self.apiclient,
|
||||
id=self.small_virtual_machine.id
|
||||
)
|
||||
#VM should be destroyed unless expunge thread hasn't run
|
||||
#Wait for two cycles of the expunge thread
|
||||
config = list_configurations(
|
||||
self.apiclient,
|
||||
name='expunge.interval'
|
||||
)
|
||||
expunge_cycle = int(config[0].value)*2
|
||||
while expunge_cycle > 0:
|
||||
list_vm_response = list_virtual_machines(
|
||||
self.apiclient,
|
||||
id=self.small_virtual_machine.id
|
||||
)
|
||||
if list_vm_response:
|
||||
time.sleep(expunge_cycle)
|
||||
expunge_cycle = 0
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
self.assertEqual(
|
||||
list_vm_response,
|
||||
None,
|
||||
@ -836,6 +860,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_10_attachAndDetach_iso(self):
|
||||
"""Test for detach ISO to virtual machine"""
|
||||
|
||||
@ -1077,6 +1102,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
return
|
||||
|
||||
|
||||
def test_11_get_vm_password(self):
|
||||
"""Test get VM password for password enabled template"""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user