From c6749dfe856dde677563f50dcd943bdad74d2474 Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Wed, 10 Jun 2020 18:23:32 +0530 Subject: [Test] Add TC's of PVC creation with zone check set in sc and dc both Change-Id: I4c75528e7fba934a2f9dd28d8ce79d4cf0d472dd Signed-off-by: Arun Kumar --- tests/functional/heketi/test_heketi_zones.py | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/functional/heketi/test_heketi_zones.py b/tests/functional/heketi/test_heketi_zones.py index 66a7e4e9..10646ae9 100644 --- a/tests/functional/heketi/test_heketi_zones.py +++ b/tests/functional/heketi/test_heketi_zones.py @@ -483,6 +483,7 @@ class TestHeketiZones(baseclass.BaseClass): # Create app DC with the above PVC self.create_dc_with_pvc(pvc_name, timeout=120, wait_step=3) + @pytest.mark.tier1 @ddt.data( (1, False), (1, True), @@ -525,6 +526,46 @@ class TestHeketiZones(baseclass.BaseClass): # Create app DC with the above PVC self.create_dc_with_pvc(pvc_name, timeout=120, wait_step=3) + @pytest.mark.tier1 + @ddt.data( + ("strict", "strict"), + ("none", "strict"), + ("strict", "none"), + ) + @ddt.unpack + def test_check_pvc_placement_with_zone_check_in_sc_and_dc_both( + self, check_in_dc, check_in_sc): + zone_count = 3 + + # Check amount of available online heketi zones + self._check_for_available_zones(zone_count) + + # Create storage class with arbiter option set + sc_name = self.create_storage_class( + sc_name_prefix=self.prefix, vol_name_prefix=self.prefix, + heketi_zone_checking=check_in_sc) + + # Set "user.heketi.zone-checking" to strict inside heketi dc + self._set_zone_check_env_in_heketi_dc(check_in_dc) + + # Create a PVC + pvc_name = self.create_and_wait_for_pvc( + pvc_name_prefix=self.prefix, sc_name=sc_name) + + # Validate brick placement + self._validate_brick_placement_in_correct_zone_or_with_expand_pvc( + check_in_dc, pvc_name, zone_count) + + # Make sure that gluster vol has appropriate option set + vol_info = openshift_ops.get_gluster_vol_info_by_pvc_name( + self.node, pvc_name) + self.assertIn('user.heketi.zone-checking', vol_info['options']) + self.assertEqual(vol_info['options']['user.heketi.zone-checking'], + check_in_dc) + + # Create app DC with the above PVC + self.create_dc_with_pvc(pvc_name, timeout=120, wait_step=3) + def _get_online_devices_and_nodes_with_zone(self): """ This function returns the list of nodes and devices associated to zone -- cgit