mirror of https://github.com/apache/cloudstack.git
1. Fix account, domain, limits and router tests.
2. Extra whitespace between generated Header and code.
This commit is contained in:
parent
82cbd46d99
commit
9c8da90c5d
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
# Automatically generated by addcopyright.py at 04/03/2012
|
||||
|
||||
"""Common functions
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
# Automatically generated by addcopyright.py at 04/03/2012
|
||||
|
||||
"""Utilities functions
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue