Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 13, 2023
1 parent 69e08dc commit f405fea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/test/function_test/utils/test_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ test_util::test_util(map<string, string> 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")
{
}

Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/utils/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::string> kCreateEnvs;
std::string table_name_;
const std::map<std::string, std::string> create_envs_;
int32_t table_id_;
int32_t partition_count_ = 8;
std::vector<dsn::partition_configuration> partitions_;
Expand Down

0 comments on commit f405fea

Please sign in to comment.