java.util.concurrent.TimeoutException caught when running the Vertx 4 sample Junit 5 test

1.2k views Asked by At

When running the sample test generated by start.vertx.io and got the following info.

  • Vertx 4.0
  • Java 11 and Java 15
  • Windows 10
java.util.concurrent.TimeoutException: 
The test execution timed out. Make sure your asynchronous code includes calls to 
either VertxTestContext#completeNow(), VertxTestContext#failNow() or Checkpoint#flag()

I added a GitHub action for it.

https://github.com/hantsy/vertx-sandbox/runs/1535205549

The @BeforeEach itself failed.

@ExtendWith(VertxExtension.class)
public class TestMainVerticle {

    @BeforeEach
    void deploy_verticle(Vertx vertx, VertxTestContext testContext) {
        vertx.deployVerticle(new MainVerticle(), testContext.succeeding(id -> testContext.completeNow()));
    }

    @Test
    void verticle_deployed(Vertx vertx, VertxTestContext testContext) throws Throwable {
        testContext.completeNow();
    }
}

I am new to the Vertx platform, really not sure the reason from Vertx's internal side. From the exception info, I can not find the cause root in my codes.

1

There are 1 answers

0
Hantsy On BEST ANSWER

Added a startPromise.complete() to my start(Promise<Void> startPromise) to resolve this issue.