cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [2/2] git commit: refs/heads/bvt - simulator+marvin: include a router test
Date Mon, 25 Mar 2013 13:07:54 GMT
simulator+marvin: include a router test

Added a test that will ensure the advanced router comes up in the
account belonging to the deployed VM. It should come up with the
publicip, guestip and linklocalip.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/bvt
Commit: 3307dbaecb58d2afe431498ea1582a8d1303595f
Parents: 4fcc97b
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Mon Mar 25 18:36:37 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Mon Mar 25 18:36:37 2013 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_vm_life_cycle.py |  137 ++++++++++++---------
 tools/marvin/pom.xml                         |   22 ----
 2 files changed, 79 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3307dbae/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 51e02ea..9d6c249 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -129,72 +129,79 @@ class Services:
 
 class TestDeployVM(cloudstackTestCase):
 
-    def setUp(self):
-
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.services = Services().services
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient()
         # Get Zone, Domain and templates
-        domain = get_domain(self.apiclient, self.services)
-        zone = get_zone(self.apiclient, self.services)
-        self.services['mode'] = zone.networktype
+        domain = get_domain(cls.apiclient, cls.services)
+        zone = get_zone(cls.apiclient, cls.services)
+        cls.services['mode'] = zone.networktype
 
-        #if local storage is enabled, alter the offerings to use localstorage
+        #If local storage is enabled, alter the offerings to use localstorage
         #this step is needed for devcloud
         if zone.localstorageenabled == True:
-            self.services["service_offerings"]["tiny"]["storagetype"] = 'local'
-            self.services["service_offerings"]["small"]["storagetype"] = 'local'
-            self.services["service_offerings"]["medium"]["storagetype"] = 'local'
+            cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+            cls.services["service_offerings"]["small"]["storagetype"] = 'local'
+            cls.services["service_offerings"]["medium"]["storagetype"] = 'local'
 
         template = get_template(
-                            self.apiclient,
-                            zone.id,
-                            self.services["ostype"]
-                            )
+            cls.apiclient,
+            zone.id,
+            cls.services["ostype"]
+        )
         # Set Zones and disk offerings
-        self.services["small"]["zoneid"] = zone.id
-        self.services["small"]["template"] = template.id
+        cls.services["small"]["zoneid"] = zone.id
+        cls.services["small"]["template"] = template.id
 
-        self.services["medium"]["zoneid"] = zone.id
-        self.services["medium"]["template"] = template.id
-        self.services["iso"]["zoneid"] = zone.id
+        cls.services["medium"]["zoneid"] = zone.id
+        cls.services["medium"]["template"] = template.id
+        cls.services["iso"]["zoneid"] = zone.id
 
-        # Create Account, VMs, NAT Rules etc
-        self.account = Account.create(
-                            self.apiclient,
-                            self.services["account"],
-                            domainid=domain.id
-                            )
+        cls.account = Account.create(
+            cls.apiclient,
+            cls.services["account"],
+            domainid=domain.id
+        )
+
+        cls.service_offering = ServiceOffering.create(
+            cls.apiclient,
+            cls.services["service_offerings"]["tiny"]
+        )
+
+        cls.virtual_machine = VirtualMachine.create(
+            cls.apiclient,
+            cls.services["small"],
+            accountid=cls.account.account.name,
+            domainid=cls.account.account.domainid,
+            serviceofferingid=cls.service_offering.id,
+            mode=cls.services['mode']
+        )
+
+        cls.cleanup = [
+            cls.service_offering,
+            cls.account
+        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            cls.debug("Warning! Exception in tearDown: %s" % e)
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
 
-        self.service_offering = ServiceOffering.create(
-                                    self.apiclient,
-                                    self.services["service_offerings"]["tiny"]
-                                    )
-        # Cleanup
-        self.cleanup = [
-                        self.service_offering,
-                        self.account
-                        ]
 
     @attr(tags = ["simulator", "devcloud", "advanced", "advancedns", "smoke", "basic", "sg"])
     def test_deploy_vm(self):
         """Test Deploy Virtual Machine
         """
-
         # Validate the following:
         # 1. Virtual Machine is accessible via SSH
         # 2. listVirtualMachines returns accurate information
-        # 3. The Cloud Database contains the valid information
-
-        self.virtual_machine = VirtualMachine.create(
-                                    self.apiclient,
-                                    self.services["small"],
-                                    accountid=self.account.account.name,
-                                    domainid=self.account.account.domainid,
-                                    serviceofferingid=self.service_offering.id,
-                                    mode=self.services['mode']
-                                )
-
         list_vm_response = list_virtual_machines(
                                                  self.apiclient,
                                                  id=self.virtual_machine.id
@@ -204,46 +211,60 @@ class TestDeployVM(cloudstackTestCase):
                 "Verify listVirtualMachines response for virtual machine: %s" \
                 % self.virtual_machine.id
             )
-
         self.assertEqual(
                             isinstance(list_vm_response, list),
                             True,
                             "Check list response returns a valid list"
                         )
-
         self.assertNotEqual(
                             len(list_vm_response),
                             0,
                             "Check VM available in List Virtual Machines"
                         )
         vm_response = list_vm_response[0]
-
         self.assertEqual(
 
                             vm_response.id,
                             self.virtual_machine.id,
                             "Check virtual machine id in listVirtualMachines"
                         )
-
         self.assertEqual(
                     vm_response.name,
                     self.virtual_machine.name,
                     "Check virtual machine name in listVirtualMachines"
                     )
-
         self.assertEqual(
             vm_response.state,
             'Running',
              msg="VM is not in Running state"
         )
-
         return
 
+
+    @attr(tags = ["simulator", "advanced"])
+    def test_advZoneVirtualRouter(self):
+        """
+        Test advanced zone virtual router
+        1. Is Running
+        2. is in the account the VM was deployed in
+        3. Has a linklocalip, publicip and a guestip
+        @return:
+        """
+        routers = list_routers(self.apiclient, account=self.account.account.name)
+        self.assertTrue(len(routers) > 0, msg = "No virtual router found")
+        router = routers[0]
+
+        self.assertEqual(router.state, 'Running', msg="Router is not in running state")
+        self.assertEqual(router.account, self.account.account.name, msg="Router does not
belong to the account")
+
+        #Has linklocal, public and guest ips
+        self.assertIsNotNone(router.linklocalip, msg="Router has no linklocal ip")
+        self.assertIsNotNone(router.publicip, msg="Router has no public ip")
+        self.assertIsNotNone(router.guestipaddress, msg="Router has no guest ip")
+
     def tearDown(self):
-        try:
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
+        pass
+
 
 
 class TestVMLifeCycle(cloudstackTestCase):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3307dbae/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index e9ca189..bf90ab3 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -138,28 +138,6 @@
                   </arguments>
                 </configuration>
               </execution>
-              <!--execution>
-                <id>pre-integration-test</id>
-                <phase>pre-integration-test</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <workingDirectory>${basedir}/marvin</workingDirectory>
-                  <executable>python</executable>
-                  <arguments>
-                    <argument>deployAndRun.py</argument>
-                    <argument>-c</argument>
-                    <argument>${user.dir}/${marvin.config}</argument>
-                    <argument>-t</argument>
-                    <argument>/tmp/t.log</argument>
-                    <argument>-r</argument>
-                    <argument>/tmp/r.log</argument>
-                    <argument>-f</argument>
-                    <argument>${basedir}/marvin/testSetupSuccess.py</argument>
-                  </arguments>
-                </configuration>
-              </execution-->
             </executions>
           </plugin>
         </plugins>


Mime
View raw message