From 67b253ea6361b10f11ae79b53c53dca67c4908d3 Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Wed, 11 Dec 2019 18:44:00 +0530 Subject: Fix usage of cls ins attributes in 'test_gluster_block_stability.py' Make test cases use local var 'prefix' not depending on the 'self.prefix'. We get 'AttributeError' error when 'self.prefix' is not set. And it can be set only when one of test cases gets run. Change-Id: I767e037e70e019ecb3a719d898dfe2b020dddff0 --- .../functional/gluster_stability/test_gluster_block_stability.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/functional/gluster_stability/test_gluster_block_stability.py b/tests/functional/gluster_stability/test_gluster_block_stability.py index 15393bf4..d380374b 100644 --- a/tests/functional/gluster_stability/test_gluster_block_stability.py +++ b/tests/functional/gluster_stability/test_gluster_block_stability.py @@ -118,7 +118,7 @@ class TestGlusterBlockStability(GlusterBlockBaseClass): pvc_name, dc_name) h_blockvol_list = heketi_blockvolume_list_by_name_prefix( - self.heketi_client_node, self.heketi_server_url, self.prefix) + self.heketi_client_node, self.heketi_server_url, prefix) # validate block volumes listed by heketi and pvs heketi_blockvolume_ids = sorted([bv[0] for bv in h_blockvol_list]) @@ -928,11 +928,11 @@ class TestGlusterBlockStability(GlusterBlockBaseClass): def test_tcmu_runner_failure_while_creating_and_deleting_pvc(self): """Kill the tcmu-runner service while creating and deleting PVC's""" - self.prefix = "auto-block-test-%s" % utils.get_random_str() + prefix = "auto-block-test-%s" % utils.get_random_str() # Create DC and pod with created PVC. sc_name = self.create_storage_class( - hacount=len(self.gluster_servers), vol_name_prefix=self.prefix) + hacount=len(self.gluster_servers), vol_name_prefix=prefix) pvc_name = self.create_and_wait_for_pvc(sc_name=sc_name) dc_name, pod_name = self.create_dc_with_pvc(pvc_name) @@ -986,7 +986,7 @@ class TestGlusterBlockStability(GlusterBlockBaseClass): # Validate volumes in heketi blockvolume list heketi_volumes = heketi_blockvolume_list( self.heketi_client_node, self.heketi_server_url) - volume_count = heketi_volumes.count(self.prefix) + volume_count = heketi_volumes.count(prefix) msg = ( 'Wrong volume count in heketi blockvolume list %s and expected ' 'volume count is 9 ' % volume_count) -- cgit