cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject [1/3] CLOUDSTACK-6282-Modified IpAddresses, Instances, Templates, Snapshots tests to handle KVM and modified IPAddresses for failed list cases
Date Mon, 16 Jun 2014 11:27:25 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 3a3a3902b -> 99e4da15d


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99e4da15/test/integration/component/test_escalations_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 2367253..0aa36c3 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -15,42 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestSnapshots(cloudstackTestCase):
 
@@ -61,6 +38,7 @@ class TestSnapshots(cloudstackTestCase):
             cls.testClient = super(TestSnapshots, cls).getClsTestClient()
             cls.api_client = cls.testClient.getApiClient()
             cls.services = cls.testClient.getParsedTestDataConfig()
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
             cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -123,7 +101,7 @@ class TestSnapshots(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -387,7 +365,7 @@ class TestSnapshots(cloudstackTestCase):
                           "Size of the list volume snapshot by Id is not matching"
                           )
         # Verifying details of the listed snapshot to be same as snapshot created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":snapshot_created.id,
                          "name":snapshot_created.name,
@@ -435,6 +413,8 @@ class TestSnapshots(cloudstackTestCase):
         Step11: Listing all the volume snapshots in page2
         Step12: Verifying that list size is 0
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping
the test")
         # Listing all the VM snapshots for a User
         list_vm_snaps_before = VmSnapshot.list(
                                                self.userapiclient,
@@ -529,7 +509,7 @@ class TestSnapshots(cloudstackTestCase):
                           "VM snapshot not deleted from page 2"
                           )
         # Deleting all the existing VM snapshots
-        list_vm_snaps =  VmSnapshot.list(
+        list_vm_snaps = VmSnapshot.list(
                                          self.userapiclient,
                                          listall=self.services["listall"],
                                          )
@@ -567,6 +547,8 @@ class TestSnapshots(cloudstackTestCase):
         Step7: Verifying that list size is 1
         Step8: Verifying details of the listed VM snapshot
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping
the test")
         # Listing all the VM snapshots for a User
         list_vm_snaps_before = VmSnapshot.list(
                                                self.userapiclient,
@@ -622,7 +604,7 @@ class TestSnapshots(cloudstackTestCase):
                           "Size of the list vm snapshot by Id is not matching"
                           )
         # Verifying details of the listed snapshot to be same as snapshot created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":snapshot_created.id,
                          "name":snapshot_created.name,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99e4da15/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 083ba90..06e3d42 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -15,42 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestTemplates(cloudstackTestCase):
 
@@ -91,7 +68,7 @@ class TestTemplates(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -168,14 +145,12 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
         # Creating pagesize + 1 number of Templates
         for i in range(0, (self.services["pagesize"] + 1)):
             template_created = Template.register(
                                                  self.userapiclient,
-                                                 self.services["template"],
+                                                 self.services["templateregister"],
                                                  self.zone.id,
                                                  hypervisor=self.hypervisor
                                                  )
@@ -290,9 +265,7 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_page2,
                           "Templates not deleted from page 2"
                           )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -322,14 +295,12 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
-        self.services["template"]["isextractable"] = True
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["isextractable"] = True
         # Creating aTemplate
         template_created = Template.register(
                                              self.userapiclient,
-                                             self.services["template"],
+                                             self.services["templateregister"],
                                              self.zone.id,
                                              hypervisor=self.hypervisor
                                              )
@@ -410,10 +381,8 @@ class TestTemplates(cloudstackTestCase):
                           download_template.id,
                           "Download Template details are not same as Template created"
                           )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
-        del self.services["template"]["isextractable"]
+        del self.services["templateregister"]["ostype"]
+        del self.services["templateregister"]["isextractable"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -451,13 +420,11 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
         # Creating aTemplate
         template_created = Template.register(
                                              self.userapiclient,
-                                             self.services["template"],
+                                             self.services["templateregister"],
                                              self.zone.id,
                                              hypervisor=self.hypervisor
                                              )
@@ -727,9 +694,7 @@ class TestTemplates(cloudstackTestCase):
                          edit_template_status,
                          "Edited Template details are not as expected"
                          )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -768,7 +733,7 @@ class TestTemplates(cloudstackTestCase):
                           "Failed to list Zones"
                           )
         if not len(zones_list) > 1:
-            self.fail("Enough zones doesnot exists to copy template")
+            raise unittest.SkipTest("Enough zones doesnot exists to copy template")
         else:
             # Listing all the Templates for a User in Zone 1
             list_templates_zone1 = Template.list(
@@ -794,10 +759,8 @@ class TestTemplates(cloudstackTestCase):
                               list_templates_zone2,
                               "Templates listed for newly created User in Zone2"
                               )
-            self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-            self.services["template"]["format"] = "VHD"
-            self.services["template"]["ostype"] = self.services["ostype"]
-            #Listing Hypervisors in Zone 1
+            self.services["templateregister"]["ostype"] = self.services["ostype"]
+            # Listing Hypervisors in Zone 1
             hypervisor_list = Hypervisor.list(
                                               self.apiClient,
                                               zoneid=zones_list[0].id
@@ -811,7 +774,7 @@ class TestTemplates(cloudstackTestCase):
             # Creating aTemplate in Zone 1
             template_created = Template.register(
                                                  self.userapiclient,
-                                                 self.services["template"],
+                                                 self.services["templateregister"],
                                                  zones_list[0].id,
                                                  hypervisor=hypervisor_list[0].name
                                                  )
@@ -938,7 +901,5 @@ class TestTemplates(cloudstackTestCase):
                               list_templates_zone2[0].isready,
                               "Failed to copy Template"
                               )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99e4da15/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 63661ed..cfc4556 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -740,6 +740,13 @@ test_data = {
         "ostype": "CentOS 5.3 (64-bit)",
         "templatefilter": 'self',
     },
+    "templateregister": {
+        "displaytext": "xs",
+        "name": "xs",
+        "passwordenabled": False,
+        "url": "http://10.147.28.7/templates/ttylinux_pv.vhd",
+        "format": "VHD"
+    },
     "security_group": {"name": "custom_Sec_Grp"},
     "ingress_rule": {
         "protocol": "TCP",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99e4da15/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index d9c4fae..94606df 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1547,7 +1547,7 @@ class StaticNATRule:
         return
 
     @classmethod
-    def disable(cls, apiclient, ipaddressid, virtualmachineid):
+    def disable(cls, apiclient, ipaddressid, virtualmachineid=None):
         """Disables Static NAT rule"""
 
         cmd = disableStaticNat.disableStaticNatCmd()


Mime
View raw message