You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 17:41:27 UTC
[10/18] Marvin + test changes from master Signed-off-by:
SrikanteswaraRao Talluri
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_portable_publicip.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
index efbd483..2d02a71 100644
--- a/test/integration/smoke/test_portable_publicip.py
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -18,73 +18,11 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
-class Services:
- """Test Data
- """
-
- def __init__(self):
- self.services = {
- "domain": {
- "name": "Domain",
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 128,
- # In MBs
- },
- "network_offering": {
- "name": 'Test Network offering',
- "displaytext": 'Test Network offering',
- "guestiptype": 'Isolated',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "SourceNat": 'VirtualRouter',
- "PortForwarding": 'VirtualRouter',
- },
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "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",
- "virtual_machine" : {
- "affinity": {
- "name": "webvms",
- "type": "host anti-affinity",
- },
- "hypervisor" : "XenServer",
- }
- }
-
class TestPortablePublicIPRange(cloudstackTestCase):
"""
@@ -95,15 +33,17 @@ class TestPortablePublicIPRange(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestPortablePublicIPRange, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestPortablePublicIPRange, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
# Create Account
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@@ -116,7 +56,7 @@ class TestPortablePublicIPRange(cloudstackTestCase):
def tearDownClass(cls):
try:
# Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -141,7 +81,7 @@ class TestPortablePublicIPRange(cloudstackTestCase):
"""
self.debug("attempting to create a portable Public IP range")
self.portable_ip_range = PortablePublicIpRange.create(
- self.api_client,
+ self.apiclient,
self.services
)
self.debug("attempting to verify portable Public IP range is created")
@@ -161,29 +101,31 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestPortablePublicIPAcquire, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestPortablePublicIPAcquire, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
# Create Account
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
cls.services["network"]["zoneid"] = cls.zone.id
cls.network_offering = NetworkOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["network_offering"],
)
# Enable Network offering
- cls.network_offering.update(cls.api_client, state='Enabled')
+ cls.network_offering.update(cls.apiclient, state='Enabled')
cls.services["network"]["networkoffering"] = cls.network_offering.id
cls.account_network = Network.create(
- cls.api_client,
+ cls.apiclient,
cls.services["network"],
cls.account.name,
cls.account.domainid
@@ -200,7 +142,7 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
def tearDownClass(cls):
try:
# Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -225,13 +167,13 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
"""
self.debug("attempting to create a portable Public IP range")
self.portable_ip_range = PortablePublicIpRange.create(
- self.api_client,
+ self.apiclient,
self.services
)
- ip_address = PublicIPAddress.create(self.api_client, self.account.name,
+ ip_address = PublicIPAddress.create(self.apiclient, self.account.name,
self.zone.id, self.account.domainid, isportable=True)
- ip_address.delete(self.api_client)
+ ip_address.delete(self.apiclient)
self.portable_ip_range.delete(self.apiclient)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index f102078..3c1aa62 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -20,43 +20,24 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multiprocess_shared_ = True
-class Services:
- """Test Primary storage Services
- """
-
- def __init__(self):
- self.services = {
- "nfs":
- {
- "url": "nfs://10.147.28.7/export/home/talluri/testprimary",
- # Format: File_System_Type/Location/Path
- "name": "Primary XEN"
- },
- "iscsi": {
- "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1",
- # Format : iscsi://IP Address/IQN number/LUN#
- "name": "Primary iSCSI"
- }
- }
-
class TestPrimaryStorageServices(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
self.cleanup = []
# Get Zone and pod
- self.zone = get_zone(self.apiclient, self.services)
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.pod = get_pod(self.apiclient, self.zone.id)
return
@@ -218,7 +199,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
self.assertEqual(
storage.type,
- 'NetworkFilesystem',
+ 'IscsiLUN',
"Check storage pool type "
)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_privategw_acl.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index ec5ef8b..8d20770 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -19,9 +19,9 @@
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_public_ip_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py
index 759e107..b961dc3 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -21,50 +21,26 @@ import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
import datetime
-class Services:
- """Test Dedicating Public IP addresses
- """
-
- def __init__(self):
- self.services = {
- "domain": {
- "name": "Domain",
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "gateway": "10.102.197.1",
- "netmask": "255.255.255.0",
- "forvirtualnetwork": "true",
- "startip": "10.102.197.70",
- "endip": "10.102.197.73",
- "zoneid": "1",
- "podid": "",
- "vlan": "4444",
- }
-
class TestDedicatePublicIPRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestDedicatePublicIPRange, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ cls.testClient = super(TestDedicatePublicIPRange, cls).getClsTestClient()
+ cls.apiclient = cls.testClient.getApiClient()
+ cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
-
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+ cls.services["zoneid"] = cls.zone.id
+ cls.pod = get_pod(cls.apiclient, cls.zone.id)
# Create Account
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@@ -77,7 +53,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
def tearDownClass(cls):
try:
# Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -112,7 +88,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
self.debug("Creating Public IP range")
self.public_ip_range = PublicIpRange.create(
- self.api_client,
+ self.apiclient,
self.services
)
list_public_ip_range_response = PublicIpRange.list(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_pvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py
index 38afd41..a1c146b 100644
--- a/test/integration/smoke/test_pvlan.py
+++ b/test/integration/smoke/test_pvlan.py
@@ -21,9 +21,9 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
import telnetlib
@@ -80,12 +80,6 @@ class TestPVLAN(cloudstackTestCase):
createNetworkCmd.ip6cidr="fc00:1234::/64"
createNetworkCmd.startipv6="fc00:1234::10"
createNetworkCmd.endipv6="fc00:1234::20"
- err = 0;
- try:
- createNetworkResponse = self.apiClient.createNetwork(createNetworkCmd)
- except Exception as e:
- err = 1;
- self.debug("Try alloc with ipv6, got:%s" % e)
- self.assertEqual(err, 1, "Shouldn't allow create PVLAN network with IPv6");
-
-
+ err = 0
+ createNetworkResponse = self.apiClient.createNetwork(createNetworkCmd)
+ self.assertEqual(createNetworkResponse, FAILED, "Creating PVLAN with IPv6 should fail")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
index 71900b4..389f878 100644
--- a/test/integration/smoke/test_regions.py
+++ b/test/integration/smoke/test_regions.py
@@ -17,42 +17,33 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
-class Services:
- def __init__(self):
- self.services = {
- "region": {
- "regionid": "2",
- "regionname": "Region2",
- "regionendpoint": "http://region2:8080/client"
- }
- }
-
-
class TestRegions(cloudstackTestCase):
"""Test Regions - basic region creation
"""
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- cls.domain = get_domain(cls.api_client, cls.services)
+ testClient = super(TestRegions, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
+ cls.domain = get_domain(cls.apiclient)
cls.cleanup = []
@attr(tags=["simulator", "basic", "advanced", "selfservice"])
def test_createRegion(self):
""" Test for create region
"""
- region = Region.create(self.api_client,
+ region = Region.create(self.apiclient,
self.services["region"]
)
- list_region = Region.list(self.api_client,
+ list_region = Region.list(self.apiclient,
id=self.services["region"]["regionid"]
)
@@ -86,8 +77,8 @@ class TestRegions(cloudstackTestCase):
def tearDownClass(cls):
try:
#Clean up
- cleanup_resources(cls.api_client, cls.cleanup)
- list_region = Region.list(cls.api_client, id=cls.services["region"]["regionid"])
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ list_region = Region.list(cls.apiclient, id=cls.services["region"]["regionid"])
assert list_region is None, "Region deletion fails"
except Exception as e:
- raise Exception("Warning: Region cleanup/delete fails with : %s" % e)
\ No newline at end of file
+ raise Exception("Warning: Region cleanup/delete fails with : %s" % e)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_reset_vm_on_reboot.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py
index 6cb63e3..4709df4 100644
--- a/test/integration/smoke/test_reset_vm_on_reboot.py
+++ b/test/integration/smoke/test_reset_vm_on_reboot.py
@@ -18,106 +18,56 @@
"""
#Import Local Modules
import marvin
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
_multiprocess_shared_ = True
-class Services:
- """Test VM Life Cycle Services
- """
-
- def __init__(self):
- self.services = {
-
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended in create account to
- # ensure unique username generated each time
- "password": "password",
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "service_offerings":
- {
- "small":
- {
- # Small service offering ID to for change VM
- # service offering from medium to small
- "name": "SmallInstance_volatile",
- "displaytext": "SmallInstance_volatile",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- },
- #Change this
- "template": {
- "displaytext": "xs",
- "name": "xs",
- "passwordenabled": False,
- },
- "sleep": 60,
- "timeout": 10,
- #Migrate VM to hostid
- "ostype": 'CentOS 5.3 (64-bit)',
- # CentOS 5.3 (64-bit)
- }
-
-
class TestResetVmOnReboot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestResetVmOnReboot, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(cls.api_client, cls.services)
+ domain = get_domain(cls.apiclient)
+ zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
- cls.api_client,
+ cls.apiclient,
zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ 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
cls.services["small"]["template"] = template.id
# Create account, service offerings, vm.
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["service_offerings"]["small"],
isvolatile="true"
)
#create a virtual machine
cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -131,8 +81,8 @@ class TestResetVmOnReboot(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.api_client = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
- cleanup_resources(cls.api_client, cls._cleanup)
+ cls.apiclient = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_resource_detail.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_resource_detail.py b/test/integration/smoke/test_resource_detail.py
index a0cac9b..7f4a6e7 100644
--- a/test/integration/smoke/test_resource_detail.py
+++ b/test/integration/smoke/test_resource_detail.py
@@ -21,113 +21,46 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multiprocess_shared_ = True
-class Services:
- """Test VM Life Cycle Services
- """
-
- def __init__(self):
- self.services = {
-
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended in create account to
- # ensure unique username generated each time
- "password": "password",
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "disk_offering": {
- "displaytext": "Small",
- "name": "Small",
- "storagetype": "shared",
- "disksize": 1
- },
- "service_offerings":
- {
- "small":
- {
- # Small service offering ID to for change VM
- # service offering from medium to small
- "name": "SmallInstance",
- "displaytext": "SmallInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- "big":
- {
- # Big service offering ID to for change VM
- "name": "BigInstance",
- "displaytext": "BigInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 512,
- }
- },
- #Change this
- "template": {
- "displaytext": "xs",
- "name": "xs",
- "passwordenabled": False,
- },
- "sleep": 60,
- "timeout": 10,
- #Migrate VM to hostid
- "ostype": 'CentOS 5.6 (64-bit)',
- # CentOS 5.3 (64-bit)
- }
class TestResourceDetail(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestResourceDetail, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(cls.api_client, cls.services)
+ domain = get_domain(cls.apiclient)
+ zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = zone.networktype
# Set Zones and disk offerings ??
# Create account, service offerings, vm.
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.disk_offering = DiskOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["disk_offering"]
)
#create a volume
cls.volume = Volume.create(
- cls.api_client,
+ cls.apiclient,
{ "diskname" : "ndm"},
zoneid=zone.id,
account=cls.account.name,
@@ -142,8 +75,8 @@ class TestResourceDetail(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.api_client = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
- cleanup_resources(cls.api_client, cls._cleanup)
+ cls.apiclient = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):
@@ -175,7 +108,7 @@ class TestResourceDetail(cloudstackTestCase):
listResourceDetailCmd = listResourceDetails.listResourceDetailsCmd()
listResourceDetailCmd.resourceid = self.volume.id
listResourceDetailCmd.resourcetype = "Volume"
- listResourceDetailResponse = self.api_client.listResourceDetails(listResourceDetailCmd)
+ listResourceDetailResponse = self.apiclient.listResourceDetails(listResourceDetailCmd)
self.assertEqual(listResourceDetailResponse, None, "Check if the list API \
returns an empty response")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 2bd1d5e..2aa83c3 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -18,88 +18,55 @@
"""
#Import Local Modules
import marvin
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multiprocess_shared_ = True
-class Services:
- """Test router Services
- """
-
- def __init__(self):
- self.services = {
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- "virtual_machine":
- {
- "displayname": "Test VM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "testuser",
- "password": "password",
- },
- "ostype": "CentOS 5.3 (64-bit)",
- "sleep": 60,
- "timeout": 10,
- }
-
class TestRouterServices(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestRouterServices,
- cls
- ).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestRouterServices, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
#Create an account, network, VM and IP addresses
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
cls.vm_1 = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@@ -115,12 +82,12 @@ class TestRouterServices(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(
+ cls.apiclient = super(
TestRouterServices,
cls
).getClsTestClient().getApiClient()
#Clean up, terminate the created templates
- cleanup_resources(cls.api_client, cls.cleanup)
+ cleanup_resources(cls.apiclient, cls.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -128,6 +95,7 @@ class TestRouterServices(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
+ self.hypervisor = self.testClient.getHypervisorInfo()
return
@attr(tags = ["advanced", "basic", "sg", "smoke", "provisioning"])
@@ -180,7 +148,7 @@ class TestRouterServices(cloudstackTestCase):
"Check list router response for router state"
)
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@@ -188,7 +156,7 @@ class TestRouterServices(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
"service dnsmasq status",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
@@ -262,7 +230,7 @@ class TestRouterServices(cloudstackTestCase):
"Check list router response for router state"
)
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@@ -270,7 +238,7 @@ class TestRouterServices(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
"service dnsmasq status",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
@@ -294,7 +262,7 @@ class TestRouterServices(cloudstackTestCase):
"Check dnsmasq service is running or not"
)
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@@ -302,7 +270,7 @@ class TestRouterServices(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
"service haproxy status",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
@@ -473,7 +441,7 @@ class TestRouterServices(cloudstackTestCase):
)
host = hosts[0]
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
res = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@@ -481,7 +449,7 @@ class TestRouterServices(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
"uptime",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_scale_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index 026ac13..03d2e87 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -18,119 +18,60 @@
"""
#Import Local Modules
import marvin
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
_multiprocess_shared_ = True
-class Services:
- """Test VM Life Cycle Services
- """
-
- def __init__(self):
- self.services = {
-
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended in create account to
- # ensure unique username generated each time
- "password": "password",
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "service_offerings":
- {
- "small":
- {
- # Small service offering ID to for change VM
- # service offering from medium to small
- "name": "SmallInstance",
- "displaytext": "SmallInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- "big":
- {
- # Big service offering ID to for change VM
- "name": "BigInstance",
- "displaytext": "BigInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 512,
- }
- },
- #Change this
- "template": {
- "displaytext": "xs",
- "name": "xs",
- "passwordenabled": False,
- },
- "sleep": 60,
- "timeout": 10,
- #Migrate VM to hostid
- "ostype": 'CentOS 5.3 (64-bit)',
- # CentOS 5.3 (64-bit)
- }
-
-
class TestScaleVm(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestScaleVm, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestScaleVm, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(cls.api_client, cls.services)
+ domain = get_domain(cls.apiclient)
+ zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
- cls.api_client,
+ cls.apiclient,
zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ 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
cls.services["small"]["template"] = template.id
# Create account, service offerings, vm.
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.big_offering = ServiceOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["service_offerings"]["big"]
)
#create a virtual machine
cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -144,8 +85,8 @@ class TestScaleVm(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.api_client = super(TestScaleVm, cls).getClsTestClient().getApiClient()
- cleanup_resources(cls.api_client, cls._cleanup)
+ cls.apiclient = super(TestScaleVm, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_secondary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py
index 240f54f..ac80956 100644
--- a/test/integration/smoke/test_secondary_storage.py
+++ b/test/integration/smoke/test_secondary_storage.py
@@ -20,9 +20,9 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
@@ -33,7 +33,7 @@ class TestSecStorageServices(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestSecStorageServices, cls).getClsTestClient().getApiClient()
+ cls.apiclient = super(TestSecStorageServices, cls).getClsTestClient().getApiClient()
cls._cleanup = []
return
@@ -41,7 +41,7 @@ class TestSecStorageServices(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -187,6 +187,8 @@ class TestSecStorageServices(cloudstackTestCase):
listall=True,
account='system'
)
+ self.assertEqual(validateList(list_template_response)[0], PASS,\
+ "templates list validation failed")
# Ensure all BUILTIN templates are downloaded
templateid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 70865b4..3c91859 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -17,15 +17,16 @@
""" BVT tests for Service offerings"""
#Import Local Modules
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import changeServiceForVirtualMachine,updateServiceOffering
-from marvin.integration.lib.utils import (isAlmostEqual,
+from marvin.lib.utils import (isAlmostEqual,
cleanup_resources,
random_gen)
-from marvin.integration.lib.base import (ServiceOffering,
+from marvin.lib.base import (ServiceOffering,
Account,
VirtualMachine)
-from marvin.integration.lib.common import (list_service_offering,
+from marvin.lib.common import (list_service_offering,
list_virtual_machines,
get_domain,
get_zone,
@@ -35,93 +36,13 @@ from nose.plugins.attrib import attr
_multiprocess_shared_ = True
-class Services:
- """Test Service offerings Services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended in create account to
- # ensure unique username generated each time
- "password": "password",
- },
- "off":
- {
- "name": "Service Offering",
- "displaytext": "Service Offering",
- "cpunumber": 1,
- "cpuspeed": 100, # MHz
- "memory": 128, # in MBs
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "medium": # Create a medium virtual machine instance
- {
- "displayname": "testserver",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "service_offerings":
- {
- "tiny":
- {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- "small":
- {
- # Small service offering ID to for change VM
- # service offering from medium to small
- "name": "Small Instance",
- "displaytext": "Small Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 128,
- },
- "medium":
- {
- # Medium service offering ID to for
- # change VM service offering from small to medium
- "name": "Medium Instance",
- "displaytext": "Medium Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- }
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- }
-
class TestCreateServiceOffering(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
def tearDown(self):
try:
@@ -143,7 +64,7 @@ class TestCreateServiceOffering(cloudstackTestCase):
service_offering = ServiceOffering.create(
self.apiclient,
- self.services["off"]
+ self.services["service_offerings"]
)
self.cleanup.append(service_offering)
@@ -168,27 +89,27 @@ class TestCreateServiceOffering(cloudstackTestCase):
self.assertEqual(
list_service_response[0].cpunumber,
- self.services["off"]["cpunumber"],
+ self.services["service_offerings"]["cpunumber"],
"Check server id in createServiceOffering"
)
self.assertEqual(
list_service_response[0].cpuspeed,
- self.services["off"]["cpuspeed"],
+ self.services["service_offerings"]["cpuspeed"],
"Check cpuspeed in createServiceOffering"
)
self.assertEqual(
list_service_response[0].displaytext,
- self.services["off"]["displaytext"],
+ self.services["service_offerings"]["displaytext"],
"Check server displaytext in createServiceOfferings"
)
self.assertEqual(
list_service_response[0].memory,
- self.services["off"]["memory"],
+ self.services["service_offerings"]["memory"],
"Check memory in createServiceOffering"
)
self.assertEqual(
list_service_response[0].name,
- self.services["off"]["name"],
+ self.services["service_offerings"]["name"],
"Check name in createServiceOffering"
)
return
@@ -212,25 +133,30 @@ class TestServiceOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ testClient = super(TestServiceOfferings, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
+ domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.service_offering_1 = ServiceOffering.create(
- cls.api_client,
- cls.services["off"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
cls.service_offering_2 = ServiceOffering.create(
- cls.api_client,
- cls.services["off"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
@@ -240,22 +166,22 @@ class TestServiceOfferings(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.medium_offering = ServiceOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["service_offerings"]["medium"]
)
cls.medium_virtual_machine = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["medium"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -272,9 +198,9 @@ class TestServiceOfferings(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
+ cls.apiclient = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created templates
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index e3bd186..a9be4e2 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -15,129 +15,35 @@
# specific language governing permissions and limitations
# under the License.
+from marvin.codes import FAILED
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-
-class Services:
- """Test Snapshots Services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 200, # in MHz
- "memory": 256, # In MBs
- },
- "disk_offering": {
- "displaytext": "Small Disk",
- "name": "Small Disk",
- "disksize": 1
- },
- "server_with_disk":
- {
- "displayname": "Test VM -With Disk",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
-
- "server_without_disk":
- {
- "displayname": "Test VM-No Disk",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- # For NAT rule creation
- "publicport": 22,
- "protocol": 'TCP',
- },
- "server": {
- "displayname": "TestVM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "mgmt_server": {
- "ipaddress": '192.168.100.21',
- "username": "root",
- "password": "password",
- "port": 22,
- },
- "recurring_snapshot": {
- "intervaltype": 'HOURLY',
- # Frequency of snapshots
- "maxsnaps": 1, # Should be min 2
- "schedule": 1,
- "timezone": 'US/Arizona',
- # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
- },
- "templates": {
- "displaytext": 'Template',
- "name": 'Template',
- "ostype": "CentOS 5.3 (64-bit)",
- "templatefilter": 'self',
- },
- "volume": {
- "diskname": "APP Data Volume",
- "size": 1, # in GBs
- "diskdevice": ['/dev/xvdb', '/dev/sdb', '/dev/hdb', '/dev/vdb' ], # Data Disk
- },
- "paths": {
- "mount_dir": "/mnt/tmp",
- "sub_dir": "test",
- "sub_lvl_dir1": "test1",
- "sub_lvl_dir2": "test2",
- "random_data": "random.data",
- },
- "ostype": "CentOS 5.3 (64-bit)",
- # Cent OS 5.3 (64 bit)
- "sleep": 60,
- "timeout": 10,
- }
-
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
class TestSnapshotRootDisk(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestSnapshotRootDisk, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestSnapshotRootDisk, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ 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
cls.services["templates"]["ostypeid"] = template.ostypeid
@@ -145,20 +51,17 @@ class TestSnapshotRootDisk(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
-
- cls.services["account"] = cls.account.name
-
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
cls.virtual_machine = cls.virtual_machine_with_disk = \
VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["server_without_disk"],
templateid=template.id,
accountid=cls.account.name,
@@ -176,7 +79,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_ssvm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index cf40907..ffa620b 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -21,9 +21,9 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
import telnetlib
@@ -31,24 +31,14 @@ import telnetlib
import time
_multiprocess_shared_ = True
-class Services:
- """Test SSVM Services
- """
-
- def __init__(self):
- self.services = {
- "sleep": 60,
- "timeout": 10,
- }
-
class TestSSVMs(cloudstackTestCase):
def setUp(self):
-
self.apiclient = self.testClient.getApiClient()
+ self.hypervisor = self.testClient.getHypervisorInfo()
self.cleanup = []
- self.services = Services().services
- self.zone = get_zone(self.apiclient, self.services)
+ self.services = self.testClient.getParsedTestDataConfig()
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
return
def tearDown(self):
@@ -329,7 +319,7 @@ class TestSSVMs(cloudstackTestCase):
self.debug("Running SSVM check script")
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
#SSH into SSVMs is done via management server for Vmware
result = get_process_status(
self.apiclient.connection.mgtSvr,
@@ -338,7 +328,7 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient.connection.passwd,
ssvm.privateip,
"/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
@@ -369,7 +359,7 @@ class TestSSVMs(cloudstackTestCase):
)
#Check status of cloud service
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
#SSH into SSVMs is done via management server for Vmware
result = get_process_status(
self.apiclient.connection.mgtSvr,
@@ -378,7 +368,7 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient.connection.passwd,
ssvm.privateip,
"service cloud status",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
@@ -453,7 +443,7 @@ class TestSSVMs(cloudstackTestCase):
self.debug("Checking cloud process status")
- if self.apiclient.hypervisor.lower() == 'vmware':
+ if self.hypervisor.lower() == 'vmware':
#SSH into SSVMs is done via management server for vmware
result = get_process_status(
self.apiclient.connection.mgtSvr,
@@ -462,7 +452,7 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient.connection.passwd,
cpvm.privateip,
"service cloud status",
- hypervisor=self.apiclient.hypervisor
+ hypervisor=self.hypervisor
)
else:
try:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index 32b3696..4865ee3 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -18,12 +18,13 @@
"""
#Import Local Modules
import marvin
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
import urllib
from random import random
@@ -32,72 +33,6 @@ import datetime
_multiprocess_shared_ = True
-class Services:
- """Test Templates Services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- "disk_offering": {
- "displaytext": "Small",
- "name": "Small",
- "disksize": 1
- },
- "virtual_machine": {
- "displayname": "testVM",
- "hypervisor": 'XenServer',
- "protocol": 'TCP',
- "ssh_port": 22,
- "username": "root",
- "password": "password",
- "privateport": 22,
- "publicport": 22,
- },
- "volume": {
- "diskname": "Test Volume",
- },
- "template_1": {
- "displaytext": "Cent OS Template",
- "name": "Cent OS Template",
- "ostype": "CentOS 5.3 (64-bit)",
- },
- "template_2": {
- "displaytext": "Public Template",
- "name": "Public template",
- "ostype": "CentOS 5.3 (64-bit)",
- "isfeatured": True,
- "ispublic": True,
- "isextractable": True,
- "mode": "HTTP_DOWNLOAD",
- },
- "templatefilter": 'self',
- "isfeatured": True,
- "ispublic": True,
- "isextractable": False,
- "bootable": True,
- "passwordenabled": True,
- "ostype": "CentOS 5.3 (64-bit)",
- "sleep": 30,
- "timeout": 10,
- }
-
-
class TestCreateTemplate(cloudstackTestCase):
def setUp(self):
@@ -118,23 +53,28 @@ class TestCreateTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.services = Services().services
- cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+
+ testClient = super(TestCreateTemplate, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["disk_offering"]
)
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
- cls.services["template_1"]["ostypeid"] = template.ostypeid
+ if template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
+ cls.services["template"]["ostypeid"] = template.ostypeid
cls.services["template_2"]["ostypeid"] = template.ostypeid
cls.services["ostypeid"] = template.ostypeid
@@ -144,19 +84,17 @@ class TestCreateTemplate(cloudstackTestCase):
cls.services["sourcezoneid"] = cls.zone.id
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
- cls.services["account"] = cls.account.name
-
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
#create virtual machine
cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@@ -166,7 +104,7 @@ class TestCreateTemplate(cloudstackTestCase):
)
#Stop virtual machine
- cls.virtual_machine.stop(cls.api_client)
+ cls.virtual_machine.stop(cls.apiclient)
# Poll listVM to ensure VM is stopped properly
timeout = cls.services["timeout"]
@@ -175,7 +113,7 @@ class TestCreateTemplate(cloudstackTestCase):
# Ensure that VM is in stopped state
list_vm_response = list_virtual_machines(
- cls.api_client,
+ cls.apiclient,
id=cls.virtual_machine.id
)
@@ -193,7 +131,7 @@ class TestCreateTemplate(cloudstackTestCase):
timeout = timeout - 1
list_volume = list_volumes(
- cls.api_client,
+ cls.apiclient,
virtualmachineid=cls.virtual_machine.id,
type='ROOT',
listall=True
@@ -210,9 +148,9 @@ class TestCreateTemplate(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+ cls.apiclient = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
#Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -233,7 +171,7 @@ class TestCreateTemplate(cloudstackTestCase):
#Create template from Virtual machine and Volume ID
template = Template.create(
self.apiclient,
- self.services["template_1"],
+ self.services["template"],
self.volume.id,
account=self.account.name,
domainid=self.account.domainid
@@ -264,18 +202,18 @@ class TestCreateTemplate(cloudstackTestCase):
self.assertEqual(
template_response.displaytext,
- self.services["template_1"]["displaytext"],
+ self.services["template"]["displaytext"],
"Check display text of newly created template"
)
name = template_response.name
self.assertEqual(
- name.count(self.services["template_1"]["name"]),
+ name.count(self.services["template"]["name"]),
1,
"Check name of newly created template"
)
self.assertEqual(
template_response.ostypeid,
- self.services["template_1"]["ostypeid"],
+ self.services["template"]["ostypeid"],
"Check osTypeID of newly created template"
)
return
@@ -286,60 +224,61 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.services = Services().services
- cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+ testClient = super(TestTemplates, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ 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()
- cls.zones = cls.api_client.listZones(cmd)
+ cls.zones = cls.apiclient.listZones(cmd)
if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
cls.disk_offering = DiskOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["disk_offering"]
)
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["volume"]["diskoffering"] = cls.disk_offering.id
cls.services["volume"]["zoneid"] = cls.zone.id
cls.services["template_2"]["zoneid"] = cls.zone.id
cls.services["sourcezoneid"] = cls.zone.id
- cls.services["template_1"]["ostypeid"] = template.ostypeid
+ cls.services["template"]["ostypeid"] = template.ostypeid
cls.services["template_2"]["ostypeid"] = template.ostypeid
cls.services["ostypeid"] = template.ostypeid
-
+ print "Before:",cls.services
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
-
+ print "After:",cls.services
cls.user = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
-
- cls.services["account"] = cls.account.name
-
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
#create virtual machine
cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
+ cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@@ -348,7 +287,7 @@ class TestTemplates(cloudstackTestCase):
mode=cls.services["mode"]
)
#Stop virtual machine
- cls.virtual_machine.stop(cls.api_client)
+ cls.virtual_machine.stop(cls.apiclient)
# Poll listVM to ensure VM is stopped properly
timeout = cls.services["timeout"]
@@ -357,7 +296,7 @@ class TestTemplates(cloudstackTestCase):
# Ensure that VM is in stopped state
list_vm_response = list_virtual_machines(
- cls.api_client,
+ cls.apiclient,
id=cls.virtual_machine.id
)
@@ -375,7 +314,7 @@ class TestTemplates(cloudstackTestCase):
timeout = timeout - 1
list_volume = list_volumes(
- cls.api_client,
+ cls.apiclient,
virtualmachineid=cls.virtual_machine.id,
type='ROOT',
listall=True
@@ -389,14 +328,14 @@ class TestTemplates(cloudstackTestCase):
#Create templates for Edit, Delete & update permissions testcases
cls.template_1 = Template.create(
- cls.api_client,
- cls.services["template_1"],
+ cls.apiclient,
+ cls.services["template"],
cls.volume.id,
account=cls.account.name,
domainid=cls.account.domainid
)
cls.template_2 = Template.create(
- cls.api_client,
+ cls.apiclient,
cls.services["template_2"],
cls.volume.id,
account=cls.account.name,
@@ -412,9 +351,9 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+ cls.apiclient = super(TestTemplates, cls).getClsTestClient().getApiClient()
#Cleanup created resources such as templates and VMs
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -438,7 +377,7 @@ class TestTemplates(cloudstackTestCase):
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice", "test"])
def test_02_edit_template(self):
"""Test Edit template
"""
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_ha.py b/test/integration/smoke/test_vm_ha.py
index 2dd514d..f549243 100644
--- a/test/integration/smoke/test_vm_ha.py
+++ b/test/integration/smoke/test_vm_ha.py
@@ -25,13 +25,13 @@ from marvin.cloudstackTestCase import cloudstackTestCase
#Import Integration Libraries
#base - contains all resources as entities and defines create, delete, list operations on them
-from marvin.integration.lib.base import Account, VirtualMachine, Cluster, Host, ServiceOffering, Configurations, SimulatorMock
+from marvin.lib.base import Account, VirtualMachine, Cluster, Host, ServiceOffering, Configurations, SimulatorMock
#utils - utility classes for common cleanup, external library wrappers etc
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
#common - commonly used methods for all tests are listed here
-from marvin.integration.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_template
from nose.plugins.attrib import attr