You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ga...@apache.org on 2015/06/08 10:09:13 UTC

git commit: updated refs/heads/master to 6140db5

Repository: cloudstack
Updated Branches:
  refs/heads/master b272d7717 -> 6140db50b


CLOUDSTACK-8542: Correcting test case in test_vpc_on_host_maintenance.py

Signed-off-by: Gaurav Aradhye <ga...@clogeny.com>
This closes #360


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6140db50
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6140db50
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6140db50

Branch: refs/heads/master
Commit: 6140db50b3d6ca79329cfcaf2f4293da8e38310d
Parents: b272d77
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Jun 5 14:35:56 2015 +0530
Committer: Gaurav Aradhye <ga...@clogeny.com>
Committed: Mon Jun 8 13:37:37 2015 +0530

----------------------------------------------------------------------
 .../maint/test_vpc_on_host_maintenance.py       | 121 +++----------------
 1 file changed, 17 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6140db50/test/integration/component/maint/test_vpc_on_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_vpc_on_host_maintenance.py b/test/integration/component/maint/test_vpc_on_host_maintenance.py
index 8ee50bf..3735b68 100644
--- a/test/integration/component/maint/test_vpc_on_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_on_host_maintenance.py
@@ -24,65 +24,23 @@ from marvin.lib.base import (Account,
                              VpcOffering)
 from marvin.lib.common import (get_domain,
                                get_zone,
-                               get_template,
-                               list_configurations)
+                               get_template)
 import time
 
-
-class Services:
-
-    """Test VPC 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",
-            },
-            "vpc_offering": {
-                "name": 'VPC off',
-                "displaytext": 'VPC off',
-                "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,\
-UserData,StaticNat,NetworkACL',
-            },
-            "vpc": {
-                "name": "TestVPC",
-                "displaytext": "TestVPC",
-                "cidr": '10.0.0.1/24'
-            },
-            "virtual_machine": {
-                "displayname": "Test VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                # Hypervisor type should be same as
-                # hypervisor type of cluster
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            # Cent OS 5.3 (64 bit)
-            "sleep": 60,
-            "timeout": 10
-        }
-
-
 class TestVPCHostMaintenance(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
         cls.testClient = super(TestVPCHostMaintenance, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
-        cls.services = Services().services
+        cls._cleanup = []
+        cls.hosts = []
+        cls.vpcSupported = True
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        if cls.hypervisor.lower() in ['hyperv']:
+            cls.vpcSupported = False
+            return
+        cls.services = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -135,9 +93,7 @@ class TestVPCHostMaintenance(cloudstackTestCase):
                             host.name)
                     timeout = timeout - 1
 
-        cls._cleanup = [
-            cls.vpc_off
-        ]
+        cls._cleanup.append(cls.vpc_off)
         return
 
     @classmethod
@@ -166,13 +122,18 @@ class TestVPCHostMaintenance(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+        if not self.vpcSupported:
+            self.skipTest("VPC is not supported on %s" % self.hypervisor)
+
         self.account = Account.create(
             self.apiclient,
             self.services["account"],
             admin=True,
             domainid=self.domain.id
         )
-        self.cleanup = [self.account]
+        self.cleanup.append(self.account)
         return
 
     def tearDown(self):
@@ -255,53 +216,5 @@ class TestVPCHostMaintenance(cloudstackTestCase):
             domainid=self.account.domainid,
             start=False
         )
-        self.validate_vpc_network(vpc, state='inactive')
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_02_create_vpc_wait_gc(self):
-        """ Test VPC when host is in maintenance mode and wait till nw gc
-        """
-
-        # Validate the following
-        # 1. Put the host in maintenance mode.
-        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
-        # 3. Wait for the VPC GC thread to run.
-        # 3. VPC will be created but will be in "Disabled" state and should
-        #    get deleted
-
-        self.debug("creating a VPC network in the account: %s" %
-                   self.account.name)
-        self.services["vpc"]["cidr"] = '10.1.1.1/16'
-        vpc = VPC.create(
-            self.apiclient,
-            self.services["vpc"],
-            vpcofferingid=self.vpc_off.id,
-            zoneid=self.zone.id,
-            account=self.account.name,
-            domainid=self.account.domainid,
-            start=False
-        )
-        self.validate_vpc_network(vpc, state='inactive')
-        interval = list_configurations(
-            self.apiclient,
-            name='network.gc.interval'
-        )
-        wait = list_configurations(
-            self.apiclient,
-            name='network.gc.wait'
-        )
-        self.debug("Sleep till network gc thread runs..")
-        # Sleep to ensure that all resources are deleted
-        time.sleep(int(interval[0].value) + int(wait[0].value))
-        vpcs = VPC.list(
-            self.apiclient,
-            id=vpc.id,
-            listall=True
-        )
-        self.assertEqual(
-            vpcs,
-            None,
-            "List VPC should not return anything after network gc"
-        )
+        self.validate_vpc_network(vpc, state='enabled')
         return