summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2018-11-15 21:24:27 +0530
committerValerii Ponomarov <vponomar@redhat.com>2018-11-20 14:26:41 +0530
commitb450c623cf8628acbd27f784a20833ac02fa60ca (patch)
treeec7889a93f46633262c1ac378d0a69f02198584b /tests
parent81da4143dd7d8d0d46e2c97d2f51a9f0b95c7264 (diff)
Add more details in case of error for CNS-550 tc
If 'test_blockvolume_create_no_free_space' tc fails, then we get too few info about the error. So, add more data to the error message. In addition, add 2 sec sleep to avoid races getting list of block hosting volumes. Change-Id: I53cdff368b4f9813a31226921d0554e98790c7a1
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
index dbb72e9b..fcc00535 100644
--- a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
+++ b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
@@ -1,6 +1,9 @@
+import time
+
from glustolibs.gluster.exceptions import ExecutionError
from glusto.core import Glusto as g
from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info
+import six
from cnslibs.common.heketi_libs import HeketiClientSetupBaseClass
from cnslibs.common.heketi_ops import (heketi_volume_create,
@@ -214,11 +217,15 @@ class TestHeketiVolume(HeketiClientSetupBaseClass):
heketi_blockvolume_delete, self.heketi_client_node,
self.heketi_server_url, blockvol1['id'])
+ # Sleep for couple of seconds to avoid races
+ time.sleep(2)
+
# Get info about block hosting volume available space
file_volumes = heketi_volume_list(
self.heketi_client_node, self.heketi_server_url, json=True)
self.assertTrue(file_volumes)
max_freesize = 0
+ file_volumes_debug_info = []
for vol_id in file_volumes["volumes"]:
vol = heketi_volume_info(
self.heketi_client_node, self.heketi_server_url,
@@ -226,6 +233,13 @@ class TestHeketiVolume(HeketiClientSetupBaseClass):
current_freesize = vol.get("blockinfo", {}).get("freesize", 0)
if current_freesize > max_freesize:
max_freesize = current_freesize
+ if current_freesize:
+ file_volumes_debug_info.append(six.text_type({
+ 'id': vol.get('id', '?'),
+ 'name': vol.get('name', '?'),
+ 'size': vol.get('size', '?'),
+ 'blockinfo': vol.get('blockinfo', '?'),
+ }))
self.assertGreater(max_freesize, 0)
# Try to create blockvolume with size bigger than available
@@ -237,4 +251,9 @@ class TestHeketiVolume(HeketiClientSetupBaseClass):
self.addCleanup(
heketi_blockvolume_delete, self.heketi_client_node,
self.heketi_server_url, blockvol2['id'])
- self.assertFalse(blockvol2, 'Volume unexpectedly was created')
+ self.assertFalse(
+ blockvol2,
+ "Volume unexpectedly was created. Calculated 'max free size' is "
+ "'%s'.\nBlock volume info is: %s \n"
+ "Block hosting volumes which were considered: \n%s" % (
+ max_freesize, blockvol2, '\n'.join(file_volumes_debug_info)))