diff --git a/src/tests/test_common/homestore_test_common.hpp b/src/tests/test_common/homestore_test_common.hpp index 09df96fc1..33b6d63a6 100644 --- a/src/tests/test_common/homestore_test_common.hpp +++ b/src/tests/test_common/homestore_test_common.hpp @@ -175,7 +175,7 @@ class HSTestHelper { static void start_homestore(const std::string& test_name, std::map< uint32_t, test_params >&& svc_params, hs_before_services_starting_cb_t cb = nullptr, bool fake_restart = false, - bool init_device = true) { + bool init_device = true, uint32_t shutdown_delay_sec = 5) { auto const ndevices = SISL_OPTIONS["num_devs"].as< uint32_t >(); auto const dev_size = SISL_OPTIONS["dev_size_mb"].as< uint64_t >() * 1024 * 1024; auto num_threads = SISL_OPTIONS["num_threads"].as< uint32_t >(); @@ -185,7 +185,7 @@ class HSTestHelper { if (fake_restart) { shutdown_homestore(false); // sisl::GrpcAsyncClientWorker::shutdown_all(); - std::this_thread::sleep_for(std::chrono::seconds{10}); + std::this_thread::sleep_for(std::chrono::seconds{shutdown_delay_sec}); } std::vector< homestore::dev_info > device_info; diff --git a/src/tests/test_common/hs_repl_test_common.hpp b/src/tests/test_common/hs_repl_test_common.hpp index 1d78bc432..6367be928 100644 --- a/src/tests/test_common/hs_repl_test_common.hpp +++ b/src/tests/test_common/hs_repl_test_common.hpp @@ -186,12 +186,12 @@ class HSReplTestHelper { setup(); } - void restart() { + void restart(uint32_t shutdown_delay_secs = 5) { test_common::HSTestHelper::start_homestore( name_ + std::to_string(replica_num_), {{HS_SERVICE::REPLICATION, {.repl_app = std::make_unique< TestReplApplication >(*this)}}, {HS_SERVICE::LOG, {}}}, - nullptr, true /* restart */); + nullptr, true /* restart */, true /* init_device */, shutdown_delay_secs); } void restart_one_by_one() { @@ -305,4 +305,4 @@ class HSReplTestHelper { Runner io_runner_; }; -} // namespace test_common \ No newline at end of file +} // namespace test_common diff --git a/src/tests/test_raft_repl_dev.cpp b/src/tests/test_raft_repl_dev.cpp index a3ee43707..42dddfa3b 100644 --- a/src/tests/test_raft_repl_dev.cpp +++ b/src/tests/test_raft_repl_dev.cpp @@ -360,7 +360,7 @@ TEST_F(RaftReplDevTest, All_restart_one_follower_inc_resync) { // step-2: restart one non-leader replica if (g_helper->replica_num() == 1) { LOGINFO("Restart homestore: replica_num = 1"); - g_helper->restart(); + g_helper->restart(10 /* shutdown_delay_sec */); g_helper->sync_for_test_start(); } @@ -419,7 +419,7 @@ TEST_F(RaftReplDevTest, All_restart_one_follower_inc_resync_with_staging) { // step-2: restart one non-leader replica if (g_helper->replica_num() == 1) { LOGINFO("Restart homestore: replica_num = 1"); - g_helper->restart(); + g_helper->restart(10 /* shutdown_delay_sec */); g_helper->sync_for_test_start(); }