From 352d0009217ab8ad6786e1a6ca929acbd5912d13 Mon Sep 17 00:00:00 2001 From: chenxu14 <47170471+chenxu14@users.noreply.github.com> Date: Thu, 13 Aug 2020 16:43:27 +0800 Subject: [PATCH] MetaClientTest.HeartbeatTest may be hung (#2296) Co-authored-by: dangleptr <37216992+dangleptr@users.noreply.github.com> --- src/meta/test/MetaClientTest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/meta/test/MetaClientTest.cpp b/src/meta/test/MetaClientTest.cpp index 1ee1220b1b4..c72e7db70dd 100644 --- a/src/meta/test/MetaClientTest.cpp +++ b/src/meta/test/MetaClientTest.cpp @@ -1149,7 +1149,9 @@ TEST(MetaClientTest, HeartbeatTest) { FLAGS_heartbeat_interval_secs = 1; const nebula::ClusterID kClusterId = 10; fs::TempDir rootPath("/tmp/MetaClientTest.XXXXXX"); - auto sc = TestUtils::mockMetaServer(10001, rootPath.path(), kClusterId); + // Let the system choose an available port for us + int32_t localMetaPort = 0; + auto sc = TestUtils::mockMetaServer(localMetaPort, rootPath.path(), kClusterId); auto threadPool = std::make_shared(1); IPv4 localIp; @@ -1163,8 +1165,7 @@ TEST(MetaClientTest, HeartbeatTest) { options.clusterId_ = kClusterId; options.inStoraged_ = true; auto client = std::make_shared(threadPool, - std::vector{HostAddr(localIp, 10001)}, - options); + std::vector{HostAddr(localIp, sc->port_)}, options); client->waitForMetadReady(); client->registerListener(listener.get()); {