diff options
author | adityaramteke <adityaramteke05icr@gmail.com> | 2021-02-01 14:08:28 +0530 |
---|---|---|
committer | adityaramteke <adityaramteke05icr@gmail.com> | 2021-02-05 10:21:52 +0530 |
commit | 0ffa66a46deae46716619697db754c323b8ee41f (patch) | |
tree | 77b1c994499eec0ed866b62b258a48ef75e92408 /tests/functional/heketi | |
parent | cbfdf5fd396e7757166c317851f0b5d3f9c49683 (diff) |
[Test] Add TC to validate volume failure when settage only on one device
Change-Id: I5b350f4a51233ff23b13c37f0b2ddfb75ef87d44
Signed-off-by: Aditya Ramteke <aramteke@redhat.com>
Diffstat (limited to 'tests/functional/heketi')
-rwxr-xr-x | tests/functional/heketi/test_heketi_device_operations.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_heketi_device_operations.py b/tests/functional/heketi/test_heketi_device_operations.py index a6831e98..14237ed0 100755 --- a/tests/functional/heketi/test_heketi_device_operations.py +++ b/tests/functional/heketi/test_heketi_device_operations.py @@ -1,6 +1,7 @@ import ddt from glusto.core import Glusto as g import pytest +import six from openshiftstoragelibs.baseclass import BaseClass from openshiftstoragelibs.heketi_ops import ( @@ -17,6 +18,8 @@ from openshiftstoragelibs.heketi_ops import ( heketi_topology_info, heketi_volume_create, heketi_volume_delete, + rm_tags, + set_tags, validate_dev_path_vg_and_uuid, ) from openshiftstoragelibs import utils @@ -600,3 +603,25 @@ class TestHeketiDeviceOperations(BaseClass): h_node, h_url, node, dev) self.assertTrue(is_true, "Failed to verify dv_path for the " "device {}".format(dev)) + + @pytest.mark.tier3 + def test_volume_create_as_tag_maching_rule(self): + """Validate settags operation only on one device in the cluster""" + + h_node, h_server = self.heketi_client_node, self.heketi_server_url + + # Set tag on any one device in cluster + node_list = heketi_node_list(h_node, h_server, json=True) + node_info = heketi_node_info(h_node, h_server, node_list[0], json=True) + device_id = node_info.get('devices', {})[0].get('id') + set_tags(h_node, h_server, 'device', device_id, "tier:it") + self.addCleanup(rm_tags, h_node, h_server, 'device', device_id, 'tier') + + # Volume creation should fail + try: + heketi_volume_create( + h_node, h_server, 2, + gluster_volume_options="user.heketi.device-tag-match tier=it") + except AssertionError as e: + if ("Failed to allocate new volume" not in six.text_type(e)): + raise |