From 11edcd4fd059f47bafeb36da28862d96a1975683 Mon Sep 17 00:00:00 2001 From: SushilG96 Date: Thu, 28 May 2020 15:16:13 +0530 Subject: [TestFix] Add waiter to complete heketi db pending operations Change-Id: I4554daf04c97e28bd965e2509c53e13b7808bae6 Signed-off-by: susgupta --- .../functional/heketi/test_heketi_create_volume.py | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/functional/heketi/test_heketi_create_volume.py b/tests/functional/heketi/test_heketi_create_volume.py index 54a4a464..1e022f5b 100644 --- a/tests/functional/heketi/test_heketi_create_volume.py +++ b/tests/functional/heketi/test_heketi_create_volume.py @@ -461,17 +461,25 @@ class TestHeketiVolume(BaseClass): h_db_check_bricks_before = h_db_check_before["bricks"] h_db_check_vol_before = h_db_check_before["{}volumes".format(vol_type)] - # Check file/block volume pending operations before creation. - if h_db_check_vol_before["pending"]: - self.skipTest( - "Skip TC due to unexpected {}volumes pending operations" - .format(vol_type)) + # Verify file/block volumes pending operation before creation + # Wait for few min's if found and pending operation or skip tc + for w in waiter.Waiter(timeout=300, interval=10): + h_db_check_before = heketi_db_check(h_node, h_url) + h_db_check_bricks_before = h_db_check_before["bricks"] + h_db_check_vol_before = h_db_check_before["{}volumes".format( + vol_type)] - # Check bricks pending operations before creation. - if h_db_check_bricks_before["pending"]: + if(not(h_db_check_vol_before["pending"] + and h_db_check_bricks_before["pending"])): + break + + if w.expired: self.skipTest( - "Skip TC due to unexpected bricks pending operations for" - " {}volume".format(vol_type)) + "Skip TC due to unexpected {} volumes or {} bricks pending" + " operations for {}volume".format( + h_db_check_vol_before["pending"], + h_db_check_bricks_before["pending"], + vol_type)) # Fetch BHV list if vol_type == 'block': -- cgit