Skip to content

Commit 25d9056

Browse files
committed
Improve testCloseOnUndeploy
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>
1 parent 61db013 commit 25d9056

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vertx-sql-client/src/test/java/io/vertx/sqlclient/tck/ConnectionTestBase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ public void start() throws Exception {
105105

106106
@Test
107107
public void testCloseOnUndeploy(TestContext ctx) {
108-
Async done = ctx.async();
108+
Async done = ctx.async(2);
109109
vertx.deployVerticle(new AbstractVerticle() {
110110
@Override
111111
public void start(Promise<Void> startPromise) throws Exception {
112112
connect(ctx.asyncAssertSuccess(conn -> {
113113
conn.closeHandler(v -> {
114-
done.complete();
114+
done.countDown();
115115
});
116116
startPromise.complete();
117117
}));
118118
}
119119
}).onComplete(ctx.asyncAssertSuccess(id -> {
120-
vertx.undeploy(id);
120+
vertx.undeploy(id).onComplete(ctx.asyncAssertSuccess(v -> done.countDown()));
121121
}));
122122
}
123123

0 commit comments

Comments
 (0)