From 1973d754eea4e1d2c56deb42d9fbcdfb1d1892c3 Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Sat, 9 May 2020 18:18:55 +0530 Subject: [Test] Add TC to validate heketidb cleanup on idle setup Change-Id: I718fd893ddb16bd1ce86a63a732e02db3c72a160 Signed-off-by: Arun Kumar --- .../heketi/test_heketi_cluster_operations.py | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/functional/heketi/test_heketi_cluster_operations.py b/tests/functional/heketi/test_heketi_cluster_operations.py index e776914f..d5c6801d 100644 --- a/tests/functional/heketi/test_heketi_cluster_operations.py +++ b/tests/functional/heketi/test_heketi_cluster_operations.py @@ -5,6 +5,7 @@ import pytest from openshiftstoragelibs import baseclass from openshiftstoragelibs import exceptions from openshiftstoragelibs import heketi_ops +from openshiftstoragelibs.waiter import Waiter @ddt.ddt @@ -210,3 +211,27 @@ class TestClusterOperationsTestCases(baseclass.BaseClass): zone = node_details[0]["zone"] self.assertEqual( zone, storage_zone, err_msg % ("zone", zone, storage_zone)) + + @pytest.mark.tier1 + def test_heketi_server_operations_cleanup_on_idle_setup(self): + """Run heketi db clean up on an idle setup""" + h_node, h_url = self.heketi_client_node, self.heketi_server_url + err_msg = "There should not be any pending operations list {}" + + # Verify the server operations + for waiter_add in Waiter(300, 20): + initial_ops = heketi_ops.heketi_server_operations_list( + h_node, h_url) + if not initial_ops: + break + if waiter_add.expired: + self.assertFalse(initial_ops, err_msg.format(initial_ops)) + + # Run cleanup + cleanup = heketi_ops.heketi_server_operation_cleanup(h_node, h_url) + self.assertFalse( + cleanup, "Cleanup command failed with message {}".format(cleanup)) + + # Verify the server operations + final_ops = heketi_ops.heketi_server_operations_list(h_node, h_url) + self.assertFalse(final_ops, err_msg.format(final_ops)) -- cgit