diff --git a/src/graph/test/SchemaTest.cpp b/src/graph/test/SchemaTest.cpp index ed468c16213..72ff684fa93 100644 --- a/src/graph/test/SchemaTest.cpp +++ b/src/graph/test/SchemaTest.cpp @@ -210,7 +210,7 @@ TEST_F(SchemaTest, metaCommunication) { auto code = client->execute(query, resp); ASSERT_NE(cpp2::ErrorCode::SUCCEEDED, code); } - sleep(FLAGS_load_data_interval_second + 1); + sleep(FLAGS_load_data_interval_secs + 1); { cpp2::ExecutionResponse resp; std::string query = "DESCRIBE EDGE education"; diff --git a/src/meta/test/MetaHttpHandlerTest.cpp b/src/meta/test/MetaHttpHandlerTest.cpp index 2967be6670b..747278087a6 100644 --- a/src/meta/test/MetaHttpHandlerTest.cpp +++ b/src/meta/test/MetaHttpHandlerTest.cpp @@ -13,7 +13,7 @@ #include "meta/test/TestUtils.h" #include "fs/TempDir.h" -DECLARE_int32(load_data_interval_second); +DECLARE_int32(load_data_interval_secs); DECLARE_string(pid_file); namespace nebula { @@ -42,7 +42,7 @@ class MetaHttpHandlerTestEnv : public ::testing::Environment { TEST(MetaHttpHandlerTest, MetaStatusTest) { - FLAGS_load_data_interval_second = 1; + FLAGS_load_data_interval_secs = 1; fs::TempDir rootPath("/tmp/MetaClientTest.XXXXXX"); auto sc = TestUtils::mockServer(10001, rootPath.path()); diff --git a/src/storage/test/StorageHttpHandlerTest.cpp b/src/storage/test/StorageHttpHandlerTest.cpp index 81f34ef724c..3d7e5750b35 100644 --- a/src/storage/test/StorageHttpHandlerTest.cpp +++ b/src/storage/test/StorageHttpHandlerTest.cpp @@ -15,7 +15,7 @@ #include "fs/TempDir.h" DECLARE_string(meta_server_addrs); -DECLARE_int32(load_data_interval_second); +DECLARE_int32(load_data_interval_secs); namespace nebula { @@ -43,22 +43,29 @@ class StorageHttpHandlerTestEnv : public ::testing::Environment { TEST(StoragehHttpHandlerTest, StorageStatusTest) { - FLAGS_load_data_interval_second = 1; + FLAGS_load_data_interval_secs = 1; fs::TempDir rootPath("/tmp/StorageClientTest.XXXXXX"); uint32_t localIp; network::NetworkUtils::ipv4ToInt("127.0.0.1", localIp); uint32_t localMetaPort = 10001; uint32_t localDataPort = 20002; - FLAGS_meta_server_addrs = folly::stringPrintf("127.0.0.1:%d", localMetaPort); LOG(INFO) << "Start meta server...."; std::string metaPath = folly::stringPrintf("%s/meta", rootPath.path()); auto metaServerContext = meta::TestUtils::mockServer(localMetaPort, metaPath.c_str()); LOG(INFO) << "Start storage server...."; + auto threadPool = std::make_shared(1); + auto addrsRet + = network::NetworkUtils::toHosts(folly::stringPrintf("127.0.0.1:%d", localMetaPort)); + CHECK(addrsRet.ok()) << addrsRet.status(); + auto mClient + = std::make_unique(threadPool, std::move(addrsRet.value()), true); + mClient->init(); std::string dataPath = folly::stringPrintf("%s/data", rootPath.path()); - auto sc = TestUtils::mockServer(dataPath.c_str(), + auto sc = TestUtils::mockServer(mClient.get(), + dataPath.c_str(), localIp, localDataPort);