You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sw...@apache.org on 2016/04/28 22:04:12 UTC
[5/7] git commit: updated refs/heads/4.8 to d11194a
Removed sleeps and used validateList as requested.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/73cd4275
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/73cd4275
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/73cd4275
Branch: refs/heads/4.8
Commit: 73cd427555ddb1625482082ea1c2d8ba339d2e9a
Parents: 760ad0e
Author: David Mabry <dm...@ena.com>
Authored: Sat Apr 23 18:47:30 2016 -0500
Committer: David Mabry <dm...@ena.com>
Committed: Wed Apr 27 10:31:50 2016 -0400
----------------------------------------------------------------------
test/integration/component/test_volumes.py | 56 ++++++++++++-------------
1 file changed, 26 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/73cd4275/test/integration/component/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index 0d18ef3..77d8679 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -635,16 +635,13 @@ class TestAttachDetachVolume(cloudstackTestCase):
type='ROOT',
listall=True
)
- self.assertNotEqual(
- root_volume_response,
- None,
- "Check if root volume exists in ListVolumes"
- )
+
self.assertEqual(
- isinstance(root_volume_response, list),
- True,
- "Check list volumes response for valid list"
+ validateList(root_volume_response)[0],
+ PASS,
+ "Invalid response returned for root volume list"
)
+
# Grab the root volume for later use
root_volume = root_volume_response[0]
@@ -652,13 +649,18 @@ class TestAttachDetachVolume(cloudstackTestCase):
self.debug("Stopping the VM: %s" % self.virtual_machine.id)
self.virtual_machine.stop(self.apiclient)
- # Ensure VM is stopped before detaching the root volume
- time.sleep(self.services["sleep"])
-
vm_response = VirtualMachine.list(
self.apiclient,
id=self.virtual_machine.id,
)
+
+ # Ensure that vm_response is a valid list
+ self.assertEqual(
+ validateList(vm_response)[0],
+ PASS,
+ "Invalid response returned for vm_response list"
+ )
+
vm = vm_response[0]
self.assertEqual(
vm.state,
@@ -679,6 +681,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
type='ROOT',
listall=True
)
+
self.assertEqual(
no_root_volume_response,
None,
@@ -699,43 +702,36 @@ class TestAttachDetachVolume(cloudstackTestCase):
type='ROOT',
listall=True
)
- self.assertNotEqual(
- new_root_volume_response,
- None,
- "Check if root volume exists in ListVolumes"
- )
+
+ # Ensure that new_root_volume_response is a valid list
self.assertEqual(
- isinstance(new_root_volume_response, list),
- True,
- "Check list volumes response for valid list"
+ validateList(new_root_volume_response)[0],
+ PASS,
+ "Invalid response returned for new_root_volume_response list"
)
# Start VM
self.virtual_machine.start(self.apiclient)
- # Sleep to ensure that VM is in ready state
- time.sleep(self.services["sleep"])
vm_response = VirtualMachine.list(
self.apiclient,
id=self.virtual_machine.id,
)
+
# Verify VM response to check whether VM deployment was successful
self.assertEqual(
- isinstance(vm_response, list),
- True,
- "Check list VM response for valid list"
- )
- self.assertNotEqual(
- len(vm_response),
- 0,
- "Check VMs available in List VMs response"
+ validateList(vm_response)[0],
+ PASS,
+ "Invalid response returned for vm_response list during VM start up"
)
+
vm = vm_response[0]
self.assertEqual(
vm.state,
'Running',
- "Check the state of VM"
+ "Ensure the state of VM is running"
)
+
except Exception as e:
self.fail("Exception occurred: %s" % e)