From 9c8da90c5de74e60a779a45e64daf511e62be7a1 Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 9 Apr 2012 01:31:54 -0700 Subject: [PATCH] 1. Fix account, domain, limits and router tests. 2. Extra whitespace between generated Header and code. --- .../testClient/testcase/BVT-tests/__init__.py | 3 +- .../testcase/BVT-tests/test_disk_offerings.py | 1 - .../testcase/BVT-tests/test_network.py | 1 - .../BVT-tests/test_service_offerings.py | 1 - .../testcase/BVT-tests/test_vm_life_cycle.py | 1 - .../testClient/testcase/P1-tests/__init__.py | 3 +- .../testcase/P1-tests/test_accounts.py | 315 +----------------- .../testcase/P1-tests/test_blocker_bugs.py | 3 +- .../testcase/P1-tests/test_project_configs.py | 1 - .../testcase/P1-tests/test_project_limits.py | 17 +- .../testcase/P1-tests/test_resource_limits.py | 200 ++++++++++- .../testcase/P1-tests/test_routers.py | 23 +- .../testcase/P1-tests/test_snapshots.py | 20 +- tools/testClient/testcase/libs/__init__.py | 3 +- tools/testClient/testcase/libs/common.py | 1 - tools/testClient/testcase/libs/utils.py | 1 - 16 files changed, 268 insertions(+), 326 deletions(-) diff --git a/tools/testClient/testcase/BVT-tests/__init__.py b/tools/testClient/testcase/BVT-tests/__init__.py index 37f96cecb27..d65b5e89b69 100644 --- a/tools/testClient/testcase/BVT-tests/__init__.py +++ b/tools/testClient/testcase/BVT-tests/__init__.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # Copyright 2012 Citrix Systems, Inc. Licensed under the # Apache License, Version 2.0 (the "License"); you may not use this # file except in compliance with the License. Citrix Systems, Inc. @@ -9,4 +10,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Automatically generated by addcopyright.py at 04/03/2012 +# Automatically generated by addcopyright.py at 04/03/2012 \ No newline at end of file diff --git a/tools/testClient/testcase/BVT-tests/test_disk_offerings.py b/tools/testClient/testcase/BVT-tests/test_disk_offerings.py index 5760b9458aa..ef72c0a7704 100644 --- a/tools/testClient/testcase/BVT-tests/test_disk_offerings.py +++ b/tools/testClient/testcase/BVT-tests/test_disk_offerings.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """ BVT tests for Disk offerings""" #Import Local Modules diff --git a/tools/testClient/testcase/BVT-tests/test_network.py b/tools/testClient/testcase/BVT-tests/test_network.py index 0ca4fc20156..234281c213a 100644 --- a/tools/testClient/testcase/BVT-tests/test_network.py +++ b/tools/testClient/testcase/BVT-tests/test_network.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """ BVT tests for Network Life Cycle """ #Import Local Modules diff --git a/tools/testClient/testcase/BVT-tests/test_service_offerings.py b/tools/testClient/testcase/BVT-tests/test_service_offerings.py index b1af1d5b5ea..125b9dd1ac9 100644 --- a/tools/testClient/testcase/BVT-tests/test_service_offerings.py +++ b/tools/testClient/testcase/BVT-tests/test_service_offerings.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """ BVT tests for Service offerings""" #Import Local Modules diff --git a/tools/testClient/testcase/BVT-tests/test_vm_life_cycle.py b/tools/testClient/testcase/BVT-tests/test_vm_life_cycle.py index 14aebc964b9..5c29dbf14cd 100644 --- a/tools/testClient/testcase/BVT-tests/test_vm_life_cycle.py +++ b/tools/testClient/testcase/BVT-tests/test_vm_life_cycle.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """ BVT tests for Virtual Machine Life Cycle """ #Import Local Modules diff --git a/tools/testClient/testcase/P1-tests/__init__.py b/tools/testClient/testcase/P1-tests/__init__.py index 37f96cecb27..d65b5e89b69 100644 --- a/tools/testClient/testcase/P1-tests/__init__.py +++ b/tools/testClient/testcase/P1-tests/__init__.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # Copyright 2012 Citrix Systems, Inc. Licensed under the # Apache License, Version 2.0 (the "License"); you may not use this # file except in compliance with the License. Citrix Systems, Inc. @@ -9,4 +10,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Automatically generated by addcopyright.py at 04/03/2012 +# Automatically generated by addcopyright.py at 04/03/2012 \ No newline at end of file diff --git a/tools/testClient/testcase/P1-tests/test_accounts.py b/tools/testClient/testcase/P1-tests/test_accounts.py index 71269780fc2..9b1df4f8f8b 100644 --- a/tools/testClient/testcase/P1-tests/test_accounts.py +++ b/tools/testClient/testcase/P1-tests/test_accounts.py @@ -32,79 +32,6 @@ class Services: "domain": { "name": "Domain", }, - "zone": { - "dns1": '121.242.190.180', - "internaldns1": '192.168.100.1', - "name" : "Basic test", - "networktype" : "Basic", - "dns2": '121.242.190.211', - }, - "pod": { - "name": "Test Pod", - "gateway": '192.168.100.1', - "netmask": '255.255.255.0', - "startip": '192.168.100.132', - "endip": '192.168.100.140', - }, - "physical_network": { - "name" : "Physical network 1", - }, - "network": { - "name": 'guestNetworkForBasicZone', - "displaytext": 'guestNetworkForBasicZone', - }, - "public_ip": { - "gateway": '192.168.100.1', - "netmask": '255.255.255.0', - "forvirtualnetwork": False, - "startip": '192.168.100.142', - "endip": '192.168.100.149', - "vlan": "untagged", - }, - "cluster": { - "clustername": "Xen Cluster", - "clustertype": "CloudManaged", - # CloudManaged or ExternalManaged" - "hypervisor": "XenServer", - # Hypervisor type - }, - "host": { - "hypervisor": 'XenServer', - # Hypervisor type - "clustertype": 'CloudManaged', - # CloudManaged or ExternalManaged" - "url": 'http://192.168.100.211', - "username": "root", - "password": "fr3sca", - "port": 22, - "ipaddress": '192.168.100.211' - }, - - "primary_storage": { - "name": "Test Primary", - "url": "nfs://192.168.100.150/mnt/DroboFS/Shares/nfsclo3", - # Format: File_System_Type/Location/Path - }, - "sec_storage": { - "url": "nfs://192.168.100.150/mnt/DroboFS/Shares/nfsclo4" - # Format: File_System_Type/Location/Path - - - }, - "mgmt_server": { - "ipaddress": '192.168.100.21', - "port": 22, - "username": 'root', - "password": 'fr3sca', - }, - "sysVM": { - "mnt_dir": '/mnt/test', - "sec_storage": '192.168.100.150', - "path": 'TestSec', - "command": '/usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt', - "download_url": 'http://download.cloud.com/releases/2.2.0/systemvm.vhd.bz2', - "hypervisor": "xenserver", - }, "account": { "email": "test@test.com", "firstname": "Test", @@ -145,7 +72,7 @@ class Services: "template": { "displaytext": "Public Template", "name": "Public template", - "ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', + "ostypeid": 'aaf6e8c9-b609-441d-9ebd-b4eaa030a275', "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", "hypervisor": 'XenServer', "format" : 'VHD', @@ -153,7 +80,7 @@ class Services: "ispublic": True, "isextractable": True, }, - "ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', + "ostypeid": 'aaf6e8c9-b609-441d-9ebd-b4eaa030a275', # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, @@ -1015,7 +942,6 @@ class TesttemplateHierarchy(cloudstackTestCase): ) return -@unittest.skip("Open Questions") class TestAddVmToSubDomain(cloudstackTestCase): @classmethod @@ -1024,177 +950,14 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.services = Services().services # Setup working Environment- Create domain, zone, pod cluster etc. - cls.domain = Domain.create( + cls.domain = get_domain( cls.api_client, - cls.services["domain"] + cls.services ) - cls.zone = Zone.create( + cls.zone = get_zone( cls.api_client, - cls.services["zone"], - domainid=cls.domain.id + cls.services, ) - cls.services["pod"]["zoneid"] = cls.zone.id - - cls.pod = Pod.create( - cls.api_client, - cls.services["pod"] - ) - cls.services["public_ip"]["zoneid"] = cls.zone.id - cls.services["public_ip"]["podid"] = cls.pod.id - - cls.physical_network = PhysicalNetwork.create( - cls.api_client, - cls.services["physical_network"], - cls.zone.id, - cls.domain.id - ) - cls.physical_network.addTrafficType( - cls.api_client, - type='Guest' - ) - cls.physical_network.addTrafficType( - cls.api_client, - type='Management' - ) - cls.physical_network.update( - cls.api_client, - state='Enabled' - ) - nsp_list = list_nw_service_prividers( - cls.api_client, - name='VirtualRouter', - physicalNetworkId=cls.physical_network.id - ) - if isinstance(nsp_list, list): - nsp = nsp_list[0] - else: - raise Exception("List Network Service Providers call failed") - - virtual_routers = list_virtual_router_elements( - cls.api_client, - nspid=nsp.id - ) - if isinstance(virtual_routers, list): - virtual_router = virtual_routers[0] - else: - raise Exception("List virtual routers call failed") - - cmd = configureVirtualRouterElement.configureVirtualRouterElementCmd() - cmd.id = virtual_router.id - cmd.enabled = True - cls.api_client.configureVirtualRouterElement(cmd) - - cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd() - cmd.id = nsp.id - cmd.state = 'Enabled' - cls.api_client.updateNetworkServiceProvider(cmd) - - nsp_list = list_nw_service_prividers( - cls.api_client, - name='SecurityGroupProvider', - physicalNetworkId=cls.physical_network.id - ) - if isinstance(nsp_list, list): - nsp = nsp_list[0] - else: - raise Exception("List Network Service Providers call failed") - - cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd() - cmd.id = nsp.id - cmd.state = 'Enabled' - cls.api_client.updateNetworkServiceProvider(cmd) - - network_offerings = list_network_offerings( - cls.api_client, - ) - if isinstance(network_offerings, list): - cls.services["network"]["networkoffering"] = network_offerings[0].id - else: - raise Exception("Invalid Network offering ID") - - cls.services["network"]["zoneid"] = cls.zone.id - cls.network = Network.create( - cls.api_client, - cls.services["network"] - ) - - cls.public_ip_range = PublicIpRange.create( - cls.api_client, - cls.services["public_ip"] - ) - - cls.services["cluster"]["zoneid"] = cls.zone.id - cls.services["cluster"]["podid"] = cls.pod.id - - cls.cluster = Cluster.create( - cls.api_client, - cls.services["cluster"] - ) - - cls.services["host"]["zoneid"] = cls.zone.id - cls.services["host"]["podid"] = cls.pod.id - - cls.host = Host.create( - cls.api_client, - cls.cluster, - cls.services["host"] - ) - - cls.services["primary_storage"]["zoneid"] = cls.zone.id - cls.services["primary_storage"]["podid"] = cls.pod.id - - cls.primary_storage = StoragePool.create( - cls.api_client, - cls.services["primary_storage"], - cls.cluster.id - ) - - # before adding Sec Storage, First download System Templates on it - download_systemplates_sec_storage( - cls.services["mgmt_server"], - cls.services["sysVM"] - ) - - cls.services["sec_storage"]["zoneid"] = cls.zone.id - cls.services["sec_storage"]["podid"] = cls.pod.id - - cls.secondary_storage = SecondaryStorage.create( - cls.api_client, - cls.services["sec_storage"] - ) - - # Enable the zone - - cls.zone.update( - cls.api_client, - allocationstate='Enabled' - ) - # After adding Host, Clusters wait for SSVMs to come up - wait_for_ssvms( - cls.api_client, - cls.zone.id, - cls.pod.id - ) - - ssvm_response = list_ssvms( - cls.api_client, - systemvmtype='secondarystoragevm', - hostid=cls.host.id, - sleep=cls.services["sleep"] - ) - if isinstance(ssvm_response, list): - ssvm = ssvm_response[0] - else: - raise Exception("List SSVM failed") - - # Download BUILTIN templates - download_builtin_templates( - cls.api_client, - cls.zone.id, - cls.services["cluster"]["hypervisor"], - cls.services["host"], - ssvm.linklocalip - ) cls.sub_domain = Domain.create( cls.api_client, cls.services["domain"], @@ -1245,66 +1008,20 @@ class TestAddVmToSubDomain(cloudstackTestCase): domainid=cls.account_2.account.domainid, serviceofferingid=cls.service_offering.id ) - cls._cleanup = [] + cls._cleanup = [ + cls.account_2, + cls.account_1, + cls.sub_domain, + cls.service_offering + ] return @classmethod def tearDownClass(cls): - try: - # Cleanup the accounts - cls.account_1.delete(cls.api_client) - cls.account_2.delete(cls.api_client) - - cleanup_wait = list_configurations( - cls.api_client, - name='account.cleanup.interval' - ) - - # Sleep for account.cleanup.interval * 2 to wait for expunge of - # resources associated with that account - if isinstance(cleanup_wait, list): - sleep_time = int(cleanup_wait[0].value) * 2 - - time.sleep(sleep_time) - - # Delete Service offerings and sub-domains - cls.service_offering.delete(cls.api_client) - cls.sub_domain.delete(cls.api_client) - - # Enable maintenance mode of - cls.host.enableMaintenance(cls.api_client) - cls.primary_storage.enableMaintenance(cls.api_client) - - # Destroy SSVMs and wait for volumes to cleanup - ssvms = list_ssvms( - cls.api_client, - zoneid=cls.zone.id - ) - - if isinstance(ssvms, list): - for ssvm in ssvms: - cmd = destroySystemVm.destroySystemVmCmd() - cmd.id = ssvm.id - cls.api_client.destroySystemVm(cmd) - - # Sleep for account.cleanup.interval*2 to wait for SSVM volume - # to cleanup - time.sleep(sleep_time) - - # Cleanup Primary, secondary storage, hosts, zones etc. - cls.secondary_storage.delete(cls.api_client) - - cls.host.delete(cls.api_client) - cls.primary_storage.delete(cls.api_client) - - cls.network.delete(cls.api_client) - cls.cluster.delete(cls.api_client) - - cls.physical_network.delete(cls.api_client) - cls.pod.delete(cls.api_client) - cls.zone.delete(cls.api_client) - - except Exception as e: + try: + #Clean up, terminate the created resources + cleanup_resources(cls.api_client,cls._cleanup) + except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return diff --git a/tools/testClient/testcase/P1-tests/test_blocker_bugs.py b/tools/testClient/testcase/P1-tests/test_blocker_bugs.py index 821f665b4bd..1c36f57e6bc 100644 --- a/tools/testClient/testcase/P1-tests/test_blocker_bugs.py +++ b/tools/testClient/testcase/P1-tests/test_blocker_bugs.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """ Tests for Blocker bugs """ from testcase.libs.base import * @@ -482,7 +481,7 @@ class TestTemplate(cloudstackTestCase): list_template_response = Template.list( self.apiclient, templatefilter=\ - self.services["templatefilter"], + self.services["templates"]["templatefilter"], id=template.id, zoneid=self.zone.id ) diff --git a/tools/testClient/testcase/P1-tests/test_project_configs.py b/tools/testClient/testcase/P1-tests/test_project_configs.py index 187a892064f..e7abab519bd 100644 --- a/tools/testClient/testcase/P1-tests/test_project_configs.py +++ b/tools/testClient/testcase/P1-tests/test_project_configs.py @@ -192,7 +192,6 @@ class TestUserProjectCreation(cloudstackTestCase): "'allow.user.create.projects' should be true" ) - list_project = list_projects_reponse[0] # Create project as a domain admin project = Project.create( self.apiclient, diff --git a/tools/testClient/testcase/P1-tests/test_project_limits.py b/tools/testClient/testcase/P1-tests/test_project_limits.py index 7c0d4403d97..dbc677b2417 100644 --- a/tools/testClient/testcase/P1-tests/test_project_limits.py +++ b/tools/testClient/testcase/P1-tests/test_project_limits.py @@ -120,7 +120,11 @@ class TestProjectLimits(cloudstackTestCase): cls.services["user"], domainid=cls.domain.id ) - cls._cleanup = [cls.account] + cls._cleanup = [ + cls.admin, + cls.user, + cls.domain + ] return @classmethod @@ -439,7 +443,7 @@ class TestProjectLimits(cloudstackTestCase): return -class TestResourceLimitsDomain(cloudstackTestCase): +class TestResourceLimitsProject(cloudstackTestCase): @classmethod def setUpClass(cls): @@ -758,7 +762,7 @@ class TestResourceLimitsDomain(cloudstackTestCase): update_resource_limit( self.apiclient, 2, # Volume - max=1, + max=2, projectid=self.project.id ) @@ -800,6 +804,13 @@ class TestResourceLimitsDomain(cloudstackTestCase): # 3. Try create 2nd template in the project. It should give the user # appropriate error and an alert should be generated. + # Reset the volume limits + update_resource_limit( + self.apiclient, + 2, # Volume + max=5, + projectid=self.project.id + ) self.debug( "Updating template resource limits for domain: %s" % self.account.account.domainid) diff --git a/tools/testClient/testcase/P1-tests/test_resource_limits.py b/tools/testClient/testcase/P1-tests/test_resource_limits.py index 6fce3849607..c1bbeb2f134 100644 --- a/tools/testClient/testcase/P1-tests/test_resource_limits.py +++ b/tools/testClient/testcase/P1-tests/test_resource_limits.py @@ -1141,7 +1141,7 @@ class TestResourceLimitsDomain(cloudstackTestCase): self.apiclient, 2, # Volume domainid=self.account.account.domainid, - max=1 + max=2 ) self.debug("Deploying VM for account: %s" % self.account.account.name) @@ -1185,6 +1185,14 @@ class TestResourceLimitsDomain(cloudstackTestCase): # 4. Try create 3rd template in the domain. It should give the user an # appropriate error and an alert should be generated. + # Set usage_vm=1 for Account 1 + update_resource_limit( + self.apiclient, + 2, # Volume + domainid=self.account.account.domainid, + max=5 + ) + self.debug( "Updating template resource limits for domain: %s" % self.account.account.domainid) @@ -1272,3 +1280,193 @@ class TestResourceLimitsDomain(cloudstackTestCase): domainid=self.account.account.domainid, ) return + + +class TestResources(cloudstackTestCase): + + @classmethod + def setUpClass(cls): + cls.api_client = super( + TestResources, + cls + ).getClsTestClient().getApiClient() + cls.services = Services().services + # Get Zone, Domain and templates + cls.zone = get_zone(cls.api_client, cls.services) + cls._cleanup = [] + return + + @classmethod + def tearDownClass(cls): + try: + #Cleanup resources used + cleanup_resources(cls.api_client, cls._cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + def setUp(self): + self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] + return + + def tearDown(self): + try: + #Clean up, terminate the created instance, volumes and snapshots + cleanup_resources(self.apiclient, self.cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + def test_01_zones(self): + """Check the status of zones""" + + # Validate the following + # 1. List zones + # 2. Check allocation state is "enabled" or not + + zones = Zone.list( + self.apiclient, + id=self.zone.id, + listall=True + ) + self.assertEqual( + isinstance(zones, list), + True, + "Check if listZones returns a valid response" + ) + for zone in zones: + self.assertEqual( + zone.allocationstate, + 'Enabled', + "Zone allocation state should be enabled" + ) + return + + def test_02_pods(self): + """Check the status of pods""" + + # Validate the following + # 1. List pods + # 2. Check allocation state is "enabled" or not + + pods = Pod.list( + self.apiclient, + zoneid=self.zone.id, + listall=True + ) + self.assertEqual( + isinstance(pods, list), + True, + "Check if listPods returns a valid response" + ) + for pod in pods: + self.assertEqual( + pod.allocationstate, + 'Enabled', + "Pods allocation state should be enabled" + ) + return + + def test_03_clusters(self): + """Check the status of clusters""" + + # Validate the following + # 1. List clusters + # 2. Check allocation state is "enabled" or not + + clusters = Cluster.list( + self.apiclient, + zoneid=self.zone.id, + listall=True + ) + self.assertEqual( + isinstance(clusters, list), + True, + "Check if listClusters returns a valid response" + ) + for cluster in clusters: + self.assertEqual( + cluster.allocationstate, + 'Enabled', + "Clusters allocation state should be enabled" + ) + return + + def test_04_hosts(self): + """Check the status of hosts""" + + # Validate the following + # 1. List hosts with type=Routing + # 2. Check state is "Up" or not + + hosts = Host.list( + self.apiclient, + zoneid=self.zone.id, + type='Routing', + listall=True + ) + self.assertEqual( + isinstance(hosts, list), + True, + "Check if listHosts returns a valid response" + ) + for host in hosts: + self.assertEqual( + host.state, + 'Up', + "Host should be in Up state and running" + ) + return + + def test_05_storage_pools(self): + """Check the status of Storage pools""" + + # Validate the following + # 1. List storage pools for the zone + # 2. Check state is "enabled" or not + + storage_pools = StoragePool.list( + self.apiclient, + zoneid=self.zone.id, + listall=True + ) + self.assertEqual( + isinstance(storage_pools, list), + True, + "Check if listStoragePools returns a valid response" + ) + for storage_pool in storage_pools: + self.assertEqual( + storage_pool.state, + 'Up', + "storage pool should be in Up state and running" + ) + return + + def test_06_secondary_storage(self): + """Check the status of secondary storage""" + + # Validate the following + # 1. List secondary storage + # 2. Check state is "Up" or not + + sec_storages = Host.list( + self.apiclient, + zoneid=self.zone.id, + type='SecondaryStorage', + listall=True + ) + self.assertEqual( + isinstance(sec_storages, list), + True, + "Check if listHosts returns a valid response" + ) + for sec_storage in sec_storages: + self.assertEqual( + sec_storage.state, + 'Up', + "Secondary storage should be in Up state" + ) + return diff --git a/tools/testClient/testcase/P1-tests/test_routers.py b/tools/testClient/testcase/P1-tests/test_routers.py index 218500d8b37..7d115baf445 100644 --- a/tools/testClient/testcase/P1-tests/test_routers.py +++ b/tools/testClient/testcase/P1-tests/test_routers.py @@ -409,19 +409,32 @@ class TestRouterServices(cloudstackTestCase): cmd.id = virtual_machine.id self.apiclient.stopVirtualMachine(cmd) - interval = list_configurations( + gcinterval = list_configurations( self.apiclient, name='network.gc.interval' ) self.assertEqual( - isinstance(interval, list), + isinstance(gcinterval, list), True, "Check for list intervals response return valid data" ) - self.debug("network.gc.interval: %s" % interval[0].value) + self.debug("network.gc.interval: %s" % gcinterval[0].value) + + gcwait = list_configurations( + self.apiclient, + name='network.gc.wait' + ) + self.assertEqual( + isinstance(gcwait, list), + True, + "Check for list intervals response return valid data" + ) + self.debug("network.gc.wait: %s" % gcwait[0].value) + + total_wait = int(gcinterval[0].value) + int (gcwait[0].value) # Router is stopped after (network.gc.interval *2) time. Wait for - # (network.gc.interval *4) for moving router to 'Stopped' - time.sleep(int(interval[0].value) * 4) + # (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped' + time.sleep(total_wait * 2) routers = list_routers( self.apiclient, diff --git a/tools/testClient/testcase/P1-tests/test_snapshots.py b/tools/testClient/testcase/P1-tests/test_snapshots.py index da45bd73674..1e0a6cd0b07 100644 --- a/tools/testClient/testcase/P1-tests/test_snapshots.py +++ b/tools/testClient/testcase/P1-tests/test_snapshots.py @@ -655,12 +655,18 @@ class TestAccountSnapshotClean(cloudstackTestCase): # Wait for account cleanup interval time.sleep(int(interval[0].value) * 2) - with self.assertRaises(Exception): - accounts = list_accounts( + accounts = list_accounts( self.apiclient, id=self.account.account.id ) - uuids = [] + + self.assertEqual( + accounts, + None, + "List accounts should return empty list after account deletion" + ) + + uuids = [] for host in hosts: # hosts[0].name = "nfs://192.168.100.21/export/test" parse_url = (host.name).split('/') @@ -852,7 +858,8 @@ class TestSnapshotDetachedDisk(cloudstackTestCase): self.services["sub_dir"], self.services["sub_lvl_dir2"], self.services["random_data"] - ) + ), + "sync", ] for c in cmds: self.debug(ssh_client.execute(c)) @@ -1143,18 +1150,19 @@ class TestSnapshotLimit(cloudstackTestCase): True, "Check list response returns a valid list" ) - self.assertNotEqual( + self.assertEqual( len(snapshots), self.services["recurring_snapshot"]["maxsnaps"], "Check maximum number of recurring snapshots retained" ) + snapshot = snapshots[0] # Sleep to ensure that snapshot is reflected in sec storage time.sleep(self.services["sleep"]) # Fetch values from database qresultset = self.dbclient.execute( "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \ - % self.snapshot.id + % snapshot.id ) self.assertEqual( isinstance(qresultset, list), diff --git a/tools/testClient/testcase/libs/__init__.py b/tools/testClient/testcase/libs/__init__.py index 37f96cecb27..d65b5e89b69 100644 --- a/tools/testClient/testcase/libs/__init__.py +++ b/tools/testClient/testcase/libs/__init__.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # Copyright 2012 Citrix Systems, Inc. Licensed under the # Apache License, Version 2.0 (the "License"); you may not use this # file except in compliance with the License. Citrix Systems, Inc. @@ -9,4 +10,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Automatically generated by addcopyright.py at 04/03/2012 +# Automatically generated by addcopyright.py at 04/03/2012 \ No newline at end of file diff --git a/tools/testClient/testcase/libs/common.py b/tools/testClient/testcase/libs/common.py index e2c03f3ab8b..23da3122cf0 100644 --- a/tools/testClient/testcase/libs/common.py +++ b/tools/testClient/testcase/libs/common.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """Common functions """ diff --git a/tools/testClient/testcase/libs/utils.py b/tools/testClient/testcase/libs/utils.py index a81249e9e16..2a33450f822 100644 --- a/tools/testClient/testcase/libs/utils.py +++ b/tools/testClient/testcase/libs/utils.py @@ -11,7 +11,6 @@ # limitations under the License. # # Automatically generated by addcopyright.py at 04/03/2012 - """Utilities functions """