From f405fea7fbafe32009d6de9d35ecdcd87034001b Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Wed, 13 Dec 2023 21:41:50 +0800 Subject: [PATCH] 1 --- src/test/function_test/utils/test_util.cpp | 16 ++++++++-------- src/test/function_test/utils/test_util.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/function_test/utils/test_util.cpp b/src/test/function_test/utils/test_util.cpp index 1e5bc905fb..44860dc652 100644 --- a/src/test/function_test/utils/test_util.cpp +++ b/src/test/function_test/utils/test_util.cpp @@ -66,8 +66,8 @@ test_util::test_util(map create_envs) kDefaultHashkeyPrefix("hashkey_"), kDefaultSortkey("sortkey"), kDefaultValuePrefix("value_"), - table_name_("temp"), - create_envs_(std::move(create_envs)) + kCreateEnvs(std::move(create_envs)), + table_name_("temp") { } @@ -86,12 +86,12 @@ void test_util::SetUp() ddl_client_->set_max_wait_app_ready_secs(120); dsn::error_code ret = - ddl_client_->create_app(table_name_, "pegasus", partition_count_, 3, create_envs_, false); + ddl_client_->create_app(table_name_, "pegasus", partition_count_, 3, kCreateEnvs, false); if (ret == dsn::ERR_INVALID_PARAMETERS) { ASSERT_EQ(dsn::ERR_OK, ddl_client_->drop_app(table_name_, 0)); ASSERT_EQ(dsn::ERR_OK, ddl_client_->create_app( - table_name_, "pegasus", partition_count_, 3, create_envs_, false)); + table_name_, "pegasus", partition_count_, 3, kCreateEnvs, false)); } else { ASSERT_EQ(dsn::ERR_OK, ret); } @@ -182,7 +182,7 @@ void test_util::write_data(const std::string &hashkey_prefix, for (int i = 0; i < count; i++) { ASSERT_EQ(PERR_OK, client_->set(fmt::format("{}{}", hashkey_prefix, i), - "sortkey", + kDefaultSortkey, fmt::format("{}{}", value_prefix, i))); } fmt::print(stdout, "write data complete, total time = {}s\n", (dsn_now_ms() - start) / 1000); @@ -205,7 +205,7 @@ void test_util::verify_data(const std::string &table_name, for (int i = 0; i < count; i++) { std::string value_new; ASSERT_EQ(PERR_OK, - client->get(fmt::format("{}{}", hashkey_prefix, i), "sortkey", value_new)) + client->get(fmt::format("{}{}", hashkey_prefix, i), kDefaultSortkey, value_new)) << i; ASSERT_EQ(fmt::format("{}{}", value_prefix, i), value_new); } @@ -232,7 +232,7 @@ void test_util::delete_data(const std::string &table_name, ASSERT_NE(client, nullptr); int64_t start = dsn_now_ms(); for (int i = 0; i < count; i++) { - ASSERT_EQ(PERR_OK, client->del(fmt::format("{}{}", hashkey_prefix, i), "sortkey")); + ASSERT_EQ(PERR_OK, client->del(fmt::format("{}{}", hashkey_prefix, i), kDefaultSortkey)); } fmt::print(stdout, "delete data complete, total time = {}s\n", (dsn_now_ms() - start) / 1000); } @@ -248,7 +248,7 @@ void test_util::check_absent(const std::string &table_name, for (int i = 0; i < count; i++) { std::string value_new; ASSERT_EQ(PERR_NOT_FOUND, - client->get(fmt::format("{}{}", hashkey_prefix, i), "sortkey", value_new)); + client->get(fmt::format("{}{}", hashkey_prefix, i), kDefaultSortkey, value_new)); ASSERT_TRUE(value_new.empty()); } fmt::print(stdout, "verify data complete, total time = {}s\n", (dsn_now_ms() - start) / 1000); diff --git a/src/test/function_test/utils/test_util.h b/src/test/function_test/utils/test_util.h index 8c5b31ed98..2b6b4e063d 100644 --- a/src/test/function_test/utils/test_util.h +++ b/src/test/function_test/utils/test_util.h @@ -90,8 +90,8 @@ class test_util : public ::testing::Test const std::string kDefaultHashkeyPrefix; const std::string kDefaultSortkey; const std::string kDefaultValuePrefix; + const std::map kCreateEnvs; std::string table_name_; - const std::map create_envs_; int32_t table_id_; int32_t partition_count_ = 8; std::vector partitions_;