frankgh commented on code in PR #200: URL: https://github.com/apache/cassandra-sidecar/pull/200#discussion_r1988164267
########## server/src/test/java/org/apache/cassandra/sidecar/server/ServerTest.java: ########## @@ -229,34 +232,15 @@ void updateTrafficShapingOptionsWithNonZeroListenPort() @DisplayName("Server should stop immediately when there port is already in use") void stopImmediatelyWhenPortIsInUse(VertxTestContext context) { - long attemptStartTimeMillis = System.currentTimeMillis(); + CountDownLatch serverStartFailed = new CountDownLatch(1); server.start() // simulate a bind exception due to address already in use .compose(deploymentId -> Future.failedFuture(new java.net.BindException("Address already in use"))) - .onComplete(context.failing(result -> { - - try - { - serverAlreadyClosedInTest.set(true); - getBlocking(server.close(), 1, TimeUnit.MINUTES, "Stop server"); - } - catch (Exception e) - { - context.failNow(e); - return; - } - - long elapsedTimeMillis = System.currentTimeMillis() - attemptStartTimeMillis; - if (elapsedTimeMillis < TimeUnit.SECONDS.toMillis(10)) - { - context.completeNow(); - } - else - { - context.failNow("Expected server close to take less than 10000 millis, " + - "but it took " + elapsedTimeMillis + " millis"); - } - })); + .onComplete(context.failing(result -> serverStartFailed.countDown())); + Uninterruptibles.awaitUninterruptibly(serverStartFailed); Review Comment: should we wait indefinitely here? can we upperbound this? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org