diff --git a/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSessionPool.java b/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSessionPool.java index ca2eee063..00439dfb3 100644 --- a/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSessionPool.java +++ b/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSessionPool.java @@ -267,6 +267,7 @@ public void testReleaseBrokenSession() { new HostAddress(ip, 9670), new HostAddress(ip, 9671)); SessionPoolConfig config = new SessionPoolConfig(addresses, "space_for_session_pool", "root", "nebula"); + config.setHealthCheckTime(5); SessionPool sessionPool = new SessionPool(config); assert sessionPool.init(); @@ -291,6 +292,9 @@ public void testReleaseBrokenSession() { p.waitFor(5, TimeUnit.SECONDS); ProcessUtil.printProcessStatus(cmd, p); + // sleep 6 seconds to process the healthy check schedule task + Thread.sleep(6); + for (int i = 0; i < 10; i++) { try { ResultSet resultSet = sessionPool.execute("SHOW SPACES;"); @@ -313,8 +317,6 @@ public void testReleaseBrokenSession() { try { runtime.exec("docker start nebula-docker-compose_graphd0_1") .waitFor(5, TimeUnit.SECONDS); - runtime.exec("docker start nebula-docker-compose_graphd1_1") - .waitFor(5, TimeUnit.SECONDS); TimeUnit.SECONDS.sleep(5); } catch (Exception e) { e.printStackTrace();