diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2019-01-02 10:13:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.host.prod.eng.bos.redhat.com> | 2019-01-02 10:13:23 +0000 |
commit | 92927d26df28af17f8e24ccabdb2b7274b19b99b (patch) | |
tree | 1ad0ef30313f57000f1082ede053f4ce0be5e1c1 /tests | |
parent | a118c991bfd5368aee517cc26188b1e3fee82d1f (diff) | |
parent | 2f10df03bd283c66b2a3c22e40d9ed79f14f1d9e (diff) |
Merge "Fix CNS-797 and CNS-798 test cases"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py b/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py index 561e1342..98a136d6 100644 --- a/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py +++ b/tests/functional/common/heketi/test_create_distributed_replica_heketi_volume.py @@ -4,6 +4,7 @@ import math from glusto.core import Glusto as g from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info +from cnslibs.common import exceptions from cnslibs.common.heketi_libs import HeketiBaseClass from cnslibs.common.heketi_ops import (heketi_node_list, heketi_node_enable, @@ -94,10 +95,27 @@ class TestHeketiVolume(HeketiBaseClass): # Create distributed vol vol_size_gb = self._get_vol_size() heketi_url = self.heketi_server_url - heketi_vol = heketi_volume_create( - self.heketi_client_node, heketi_url, vol_size_gb, json=True) - self.assertTrue( - heketi_vol, "Failed to create vol of %d size." % vol_size_gb) + try: + g.log.info( + "Trying to create distributed '%s'Gb volume." % vol_size_gb) + heketi_vol = heketi_volume_create( + self.heketi_client_node, heketi_url, vol_size_gb, json=True) + except exceptions.ExecutionError as e: + # NOTE: rare situation when we need to decrease size of a volume. + # and we expect this vol to be distributed. + g.log.info("Failed to create distributed '%s'Gb volume. " + "Trying to create another one, smaller for 1Gb.") + if ('more required' in str(e) + and ('Insufficient suitable allocatable extents for ' + 'logical volume' in str(e))): + vol_size_gb -= 1 + heketi_vol = heketi_volume_create( + self.heketi_client_node, heketi_url, vol_size_gb, + json=True) + else: + raise + g.log.info("Successfully created distributed volume.") + vol_name = heketi_vol['name'] vol_id = heketi_vol["bricks"][0]["volume"] self.addCleanup( |