diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-11-23 09:49:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.host.prod.eng.bos.redhat.com> | 2018-11-23 09:49:59 +0000 |
commit | fb0a773bcdb357331e8c3e5f2c09e89aaeeb86fd (patch) | |
tree | 4c3e07ae65cfeb65274ec752ddc18c0ad26717b7 /tests | |
parent | 51cec40d9aae83448e594498adfeae71aa10c860 (diff) | |
parent | b450c623cf8628acbd27f784a20833ac02fa60ca (diff) |
Merge "Add more details in case of error for CNS-550 tc"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py | 21 |
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))) |