From 6078dcd2bac56abeeed4624dbe725438f757f988 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Thu, 12 Jul 2012 17:33:05 +0530 Subject: [PATCH] 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 --- test/integration/smoke/test_vm_life_cycle.py | 40 ++++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index b125aa5c768..33824743c0f 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -104,7 +104,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": { @@ -118,7 +118,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', } @@ -165,6 +165,7 @@ class TestDeployVM(cloudstackTestCase): self.account ] + def test_deploy_vm(self): """Test Deploy Virtual Machine """ @@ -312,6 +313,7 @@ class TestVMLifeCycle(cloudstackTestCase): cleanup_resources(self.apiclient, self.cleanup) return + def test_01_stop_vm(self): """Test Stop Virtual Machine """ @@ -347,6 +349,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_02_start_vm(self): """Test Start Virtual Machine """ @@ -384,6 +387,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_03_reboot_vm(self): """Test Reboot Virtual Machine """ @@ -419,6 +423,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_04_change_offering_small(self): """Change Offering to a small capacity """ @@ -536,6 +541,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_05_change_offering_medium(self): """Change Offering to a medium capacity """ @@ -657,6 +663,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_06_destroy_vm(self): """Test destroy Virtual Machine """ @@ -692,6 +699,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_07_restore_vm(self): """Test recover Virtual Machine """ @@ -731,6 +739,7 @@ class TestVMLifeCycle(cloudstackTestCase): return + def test_08_migrate_vm(self): """Test migrate VM """ @@ -821,11 +830,26 @@ class TestVMLifeCycle(cloudstackTestCase): response = config[0] # 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, @@ -833,6 +857,7 @@ class TestVMLifeCycle(cloudstackTestCase): ) return + def test_10_attachAndDetach_iso(self): """Test for detach ISO to virtual machine""" @@ -1074,6 +1099,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"""