Skip to content

Commit

Permalink
Improve testCloseOnUndeploy
Browse files Browse the repository at this point in the history
Sometimes we can see a stack trace in build logs.

It happens because the test completes before the verticle is fully undeployed.
So when the tearDown method closes vertx, another attempt to deploy the verticle is made, which prints a failure to the console, because the original verticle undeployment has been completed concurrently.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
  • Loading branch information
tsegismont committed Jan 9, 2025
1 parent 0ed4a7d commit 111a619
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ public void start() throws Exception {

@Test
public void testCloseOnUndeploy(TestContext ctx) {
Async done = ctx.async();
Async done = ctx.async(2);
vertx.deployVerticle(new AbstractVerticle() {
@Override
public void start(Promise<Void> startPromise) throws Exception {
connect(ctx.asyncAssertSuccess(conn -> {
conn.closeHandler(v -> {
done.complete();
done.countDown();
});
startPromise.complete();
}));
}
}).onComplete(ctx.asyncAssertSuccess(id -> {
vertx.undeploy(id);
vertx.undeploy(id).onComplete(ctx.asyncAssertSuccess(v -> done.countDown()));
}));
}

Expand Down

0 comments on commit 111a619

Please sign in to comment.