Skip to content

Commit

Permalink
add delay
Browse files Browse the repository at this point in the history
  • Loading branch information
yamingk committed Feb 16, 2024
1 parent 8797fe2 commit e9433b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tests/test_common/homestore_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 >();
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/tests/test_common/hs_repl_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -305,4 +305,4 @@ class HSReplTestHelper {

Runner io_runner_;
};
} // namespace test_common
} // namespace test_common
4 changes: 2 additions & 2 deletions src/tests/test_raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit e9433b7

Please sign in to comment.