You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/01/20 07:20:30 UTC
[06/12] git commit: updated refs/heads/4.5 to 4e01d61
CLOUDSTACK-7955: Fixed the script test_project_limits.py - Register Template in the Project to test the Template limits on the project
(cherry picked from commit 71bb436c8d2500cccef49e8a503663b79ef1fd71)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b5ef7de2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b5ef7de2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b5ef7de2
Branch: refs/heads/4.5
Commit: b5ef7de29096bf222685ab29e3e4ae18083eba58
Parents: d1d2885
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Thu Nov 20 11:03:23 2014 -0800
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Jan 20 11:30:59 2015 +0530
----------------------------------------------------------------------
.../component/test_project_limits.py | 109 +++++++++++--------
1 file changed, 61 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b5ef7de2/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