cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sangeet...@apache.org
Subject git commit: updated refs/heads/master to 71bb436
Date Fri, 21 Nov 2014 23:39:23 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 3a6f248e3 -> 71bb436c8


CLOUDSTACK-7955: Fixed the script test_project_limits.py - Register Template in the Project
to test the Template limits on the project


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

Branch: refs/heads/master
Commit: 71bb436c8d2500cccef49e8a503663b79ef1fd71
Parents: 3a6f248
Author: Chandan Purushothama <Chandan.Purushothama@citrix.com>
Authored: Thu Nov 20 11:03:23 2014 -0800
Committer: Sangeetha Hariharan <sangeetha.hariharan@citrix.com>
Committed: Fri Nov 21 18:25:44 2014 -0800

----------------------------------------------------------------------
 .../component/test_project_limits.py            | 109 +++++++++++--------
 1 file changed, 61 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/71bb436c/test/integration/component/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index 5d37f0b..d4fb92d 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -42,7 +42,8 @@ from marvin.lib.common import (get_domain,
                                list_volumes,
                                list_configurations,
                                list_resource_limits,
-                               update_resource_limit
+                               update_resource_limit,
+                               get_builtin_template_info
                                )
 from marvin.codes import PASS
 import time
@@ -109,7 +110,7 @@ class Services:
                                     "ostype": 'CentOS 5.3 (64-bit)',
                                     "templatefilter": 'self',
                         },
-                        "network_offering": {
+                         "network_offering": {
                                     "name": 'Network offering-VR services',
                                     "displaytext": 'Network offering-VR services',
                                     "guestiptype": 'Isolated',
@@ -904,65 +905,77 @@ class TestResourceLimitsProject(cloudstackTestCase):
                               max=1,
                               projectid=self.project.id
                               )
-
-        self.debug("Deploying VM for account: %s" % self.account.name)
-        virtual_machine_1 = VirtualMachine.create(
-                                self.apiclient,
-                                self.services["server"],
-                                templateid=self.template.id,
-                                serviceofferingid=self.service_offering.id,
-                                projectid=self.project.id
-                                )
-        self.cleanup.append(virtual_machine_1)
-        # Verify VM state
-        self.assertEqual(
-                            virtual_machine_1.state,
-                            'Running',
-                            "Check VM state is Running or not"
-                        )
-        virtual_machine_1.stop(self.apiclient)
-        # Get the Root disk of VM
-        volumes = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=virtual_machine_1.id,
-                            projectid=self.project.id,
-                            type='ROOT'
-                            )
+        
+        # Register the First Template in the project
+        self.debug("Register the First Template in the project")
+        builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
+        self.services["template"]["url"] = builtin_info[0]
+        self.services["template"]["hypervisor"] = builtin_info[1]
+        self.services["template"]["format"] = builtin_info[2]
+
+        # Register new template
+        template = Template.register(
+                                        self.userapiclient,
+                                        self.services["template"],
+                                        zoneid=self.zone.id,
+                                        projectid=self.project.id
+                                        )
+        self.debug(
+                "Registered a template of format: %s with ID: %s" % (
+                                                                self.services["template"]["format"],
+                                                                template.id
+                                                                ))
+        self.cleanup.append(template)
+
+        # Wait for template status to be changed across
+        time.sleep(self.services["sleep"])
+        timeout = self.services["timeout"]
+        while True:
+            list_template_response = Template.list(
+                                            self.apiclient,
+                                            templatefilter='all',
+                                            id=template.id,
+                                            zoneid=self.zone.id,
+                                            projectid=self.project.id,
+                                            )
+            if list_template_response[0].isready is True:
+                break
+            elif timeout == 0:
+                raise Exception("Template state is not ready, it is %s" % list_template_response[0].isready)
+
+            time.sleep(self.services["sleep"])
+            timeout = timeout - 1
+            
+        #Verify template response to check whether template added successfully
         self.assertEqual(
-                        isinstance(volumes, list),
+                        isinstance(list_template_response, list),
                         True,
-                        "Check for list volume response return valid data"
+                        "Check for list template response return valid data"
+                        )
+
+        self.assertNotEqual(
+                            len(list_template_response),
+                            0,
+                            "Check template available in List Templates"
                         )
-        volume = volumes[0]
-
-        self.debug("Creating template from volume: %s" % volume.id)
-        # Create a template from the ROOTDISK
-        template_1 = Template.create(
-                            self.userapiclient,
-                            self.services["template"],
-                            volumeid=volume.id,
-                            projectid=self.project.id
-                            )
 
-        self.cleanup.append(template_1)
-        # Verify Template state
+        template_response = list_template_response[0]
         self.assertEqual(
-                            template_1.isready,
+                            template_response.isready,
                             True,
-                            "Check Template is in ready state or not"
+                            "Template state is not ready, it is %s" % template_response.isready
                         )
 
         # Exception should be raised for second template
         with self.assertRaises(Exception):
-            Template.create(
-                            self.userapiclient,
-                            self.services["template"],
-                            volumeid=volume.id,
-                            projectid=self.project.id
+            Template.register(
+                                self.userapiclient,
+                                self.services["template"],
+                                zoneid=self.zone.id,
+                                projectid=self.project.id
                             )
         return
 
-
 class TestMaxProjectNetworks(cloudstackTestCase):
 
     @classmethod


Mime
View raw message