From 0119e6d04e56376bfd7e9b22e2a9f8eb3e2d3f91 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 9d116ba7263..772ec911c53 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -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 """ @@ -824,11 +833,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, @@ -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"""