CLOUDSTACK-5674: Fixed all BVTs and some marvin functions

This commit is contained in:
Girish Shilamkar 2014-02-19 16:33:42 +05:30
parent 38f4000108
commit 47c5b63881
15 changed files with 65 additions and 51 deletions

View File

@ -110,8 +110,8 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
testClient = super(TestDiskOfferings, cls).getClsTestClient()
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.getParsedTestDataConfig()
cls.apiclient = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
cls.disk_offering_1 = DiskOffering.create(
cls.apiclient,

View File

@ -42,7 +42,7 @@ class TestCreateIso(cloudstackTestCase):
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.services['mode'] = self.zone.networktype
self.services["domainid"] = self.domain.id
self.services["iso_2"]["zoneid"] = self.zone.id
self.services["iso2"]["zoneid"] = self.zone.id
self.account = Account.create(
self.apiclient,
@ -57,8 +57,8 @@ class TestCreateIso(cloudstackTestCase):
if not isinstance(ostypes, list):
raise unittest.SkipTest("OSTypeId for given description not found")
self.services["iso_1"]["ostypeid"] = ostypes[0].id
self.services["iso_2"]["ostypeid"] = ostypes[0].id
self.services["iso1"]["ostypeid"] = ostypes[0].id
self.services["iso2"]["ostypeid"] = ostypes[0].id
self.services["ostypeid"] = ostypes[0].id
self.cleanup = [self.account]
@ -87,7 +87,7 @@ class TestCreateIso(cloudstackTestCase):
iso = Iso.create(
self.apiclient,
self.services["iso_2"],
self.services["iso2"],
account=self.account.name,
domainid=self.account.domainid
)
@ -118,17 +118,17 @@ class TestCreateIso(cloudstackTestCase):
self.assertEqual(
iso_response.displaytext,
self.services["iso_2"]["displaytext"],
self.services["iso2"]["displaytext"],
"Check display text of newly created ISO"
)
self.assertEqual(
iso_response.name,
self.services["iso_2"]["name"],
self.services["iso2"]["name"],
"Check name of newly created ISO"
)
self.assertEqual(
iso_response.zoneid,
self.services["iso_2"]["zoneid"],
self.services["iso2"]["zoneid"],
"Check zone ID of newly created ISO"
)
return
@ -143,12 +143,12 @@ class TestISO(cloudstackTestCase):
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient, cls.testClient.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services["domainid"] = cls.domain.id
cls.services["iso_1"]["zoneid"] = cls.zone.id
cls.services["iso_2"]["zoneid"] = cls.zone.id
cls.services["iso1"]["zoneid"] = cls.zone.id
cls.services["iso2"]["zoneid"] = cls.zone.id
cls.services["sourcezoneid"] = cls.zone.id
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
@ -171,13 +171,13 @@ class TestISO(cloudstackTestCase):
if not isinstance(ostypes, list):
raise unittest.SkipTest("OSTypeId for given description not found")
cls.services["iso_1"]["ostypeid"] = ostypes[0].id
cls.services["iso_2"]["ostypeid"] = ostypes[0].id
cls.services["iso1"]["ostypeid"] = ostypes[0].id
cls.services["iso2"]["ostypeid"] = ostypes[0].id
cls.services["ostypeid"] = ostypes[0].id
cls.iso_1 = Iso.create(
cls.apiclient,
cls.services["iso_1"],
cls.services["iso1"],
account=cls.account.name,
domainid=cls.account.domainid
)
@ -189,7 +189,7 @@ class TestISO(cloudstackTestCase):
cls.iso_2 = Iso.create(
cls.apiclient,
cls.services["iso_2"],
cls.services["iso2"],
account=cls.account.name,
domainid=cls.account.domainid
)
@ -336,8 +336,8 @@ class TestISO(cloudstackTestCase):
cmd = extractIso.extractIsoCmd()
cmd.id = self.iso_2.id
cmd.mode = self.services["iso_2"]["mode"]
cmd.zoneid = self.services["iso_2"]["zoneid"]
cmd.mode = self.services["iso2"]["mode"]
cmd.zoneid = self.services["iso2"]["zoneid"]
list_extract_response = self.apiclient.extractIso(cmd)
try:
@ -358,12 +358,12 @@ class TestISO(cloudstackTestCase):
)
self.assertEqual(
list_extract_response.extractMode,
self.services["iso_2"]["mode"],
self.services["iso2"]["mode"],
"Check mode of extraction"
)
self.assertEqual(
list_extract_response.zoneid,
self.services["iso_2"]["zoneid"],
self.services["iso2"]["zoneid"],
"Check zone ID of extraction"
)
self.assertEqual(

View File

@ -45,10 +45,10 @@ class TestLoadBalance(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
cls.services["server"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
#Create an account, network, VM and IP addresses
cls.account = Account.create(
@ -63,7 +63,7 @@ class TestLoadBalance(cloudstackTestCase):
)
cls.vm_1 = VirtualMachine.create(
cls.apiclient,
cls.services["server"],
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -71,7 +71,7 @@ class TestLoadBalance(cloudstackTestCase):
)
cls.vm_2 = VirtualMachine.create(
cls.apiclient,
cls.services["server"],
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -79,7 +79,7 @@ class TestLoadBalance(cloudstackTestCase):
)
cls.vm_3 = VirtualMachine.create(
cls.apiclient,
cls.services["server"],
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -90,7 +90,7 @@ class TestLoadBalance(cloudstackTestCase):
cls.account.name,
cls.zone.id,
cls.account.domainid,
cls.services["server"]
cls.services["virtual_machine"]
)
# Open up firewall port for SSH
cls.fw_rule = FireWallRule.create(
@ -140,7 +140,7 @@ class TestLoadBalance(cloudstackTestCase):
except Exception as e:
self.fail("%s: SSH failed for VM with IP Address: %s" %
(e, ip_addr))
time.sleep(self.services["lb_switch_wait"])
time.sleep(10)
return
@attr(tags = ["advanced", "advancedns", "smoke"])

View File

@ -37,7 +37,6 @@ class TestPublicIP(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = Services().services
@classmethod
def setUpClass(cls):
@ -538,7 +537,7 @@ class TestRebootRouter(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.testClient.getParsedTestDataConfig()
self.services = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient)
@ -710,7 +709,7 @@ class TestReleaseIP(cloudstackTestCase):
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.getZoneForTests())
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
@ -847,7 +846,7 @@ class TestDeleteAccount(cloudstackTestCase):
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.getZoneForTests())
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,

View File

@ -107,7 +107,7 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
# Get Zone, Domain
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
# Create Account
cls.account = Account.create(
cls.apiclient,

View File

@ -30,8 +30,9 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.apiclient = super(TestDedicatePublicIPRange, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestDedicatePublicIPRange, cls).getClsTestClient()
cls.apivlient = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getClsTestClient.getZoneForTests())

View File

@ -46,7 +46,7 @@ class TestResetVmOnReboot(cloudstackTestCase):
cls.services["ostype"]
)
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"])
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
# Set Zones and disk offerings ??
cls.services["small"]["zoneid"] = zone.id

View File

@ -42,7 +42,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls.services["ostype"]
)
if template == FAILED:
self.assert "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
cls.services["domainid"] = cls.domain.id
cls.services["server_without_disk"]["zoneid"] = cls.zone.id

View File

@ -35,9 +35,10 @@ class TestSSVMs(cloudstackTestCase):
def setUp(self):
self.testClient = super(TestSSVMs, cls).getClsTestClient()
self.apiclient = self.testClient.getApiClient()
self.cleanup = []
self.services = Services().services
self.services = self.testClient.getParsedTestDataConfig()
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
return

View File

@ -232,7 +232,7 @@ class TestTemplates(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()

View File

@ -201,7 +201,7 @@ class TestVMLifeCycle(cloudstackTestCase):
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#if local storage is enabled, alter the offerings to use localstorage

View File

@ -29,11 +29,12 @@ class TestVmSnapshot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.apiclient = super(TestVmSnapshot, cls).getClsTestClient().getApiClient()
cls.services = Services().services
testClient = super(TestVmSnapshot, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getClsTestClient().getZoneForTests())
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
template = get_template(
cls.apiclient,

View File

@ -142,7 +142,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,

View File

@ -6,7 +6,15 @@ test_data = {
},
"zone": "NA",
"domain": { "name": "domain" },
"email" : "test@test.com",
"gateway" : "172.1.1.1",
"netmask" : "255.255.255.0",
"startip" : "172.1.1.10",
"endip" : "172.1.1.20",
"regionid" : "1",
"vlan" :"10",
"isportable" : "true",
"project": {
"name": "Project",
"displaytext": "Test project"
@ -307,7 +315,7 @@ test_data = {
"isextractable": True,
"isfeatured": True,
"ispublic": True,
"ostype": "CentOS 5.3 (64-bit)",
"ostype": "CentOS 5.6 (64-bit)",
},
"iso2": {
"displaytext": "Test ISO 2",
@ -316,7 +324,7 @@ test_data = {
"isextractable": True,
"isfeatured": True,
"ispublic": True,
"ostype": "CentOS 5.3 (64-bit)",
"ostype": "CentOS 5.6 (64-bit)",
"mode": 'HTTP_DOWNLOAD',
},
"isfeatured": True,
@ -333,7 +341,7 @@ test_data = {
"template_2": {
"displaytext": "Public Template",
"name": "Public template",
"ostype": "CentOS 5.3 (64-bit)",
"ostype": "CentOS 5.6 (64-bit)",
"isfeatured": True,
"ispublic": True,
"isextractable": True,
@ -348,7 +356,7 @@ test_data = {
"endport": "22",
"cidrlist": "0.0.0.0/0"
},
"ostype": "CentOS 5.3 (64-bit)",
"ostype": "CentOS 5.6 (64-bit)",
"sleep": 90,
"timeout": 10,
"advanced_sg": {

View File

@ -239,8 +239,12 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
cmd_out = apiclient.listPods(cmd)
return FAILED if (validateList(cmd_out)[0] != PASS) else cmd_out
if validateList(cmd_out)[0] != PASS: return FAILED
if (pod_id is None and pod_name is None):
return cmd_out[0]
else:
return cmd_out
def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
template_id=None, template_name=None, account=None, domain_id=None, project_id=None,