Vert.x thread blocked (only on pipeline) #32982
-
Hello there! I'm trying to update to Quarkus 3. And I'm facing an issue with a test. The following test is working on my computer but failing on pipeline: @Test
@RunOnVertxContext
void testCreatePilotShouldReturn201(UniAsserter asserter) {
asserter.execute(() -> {
var dto = CreatePilotDTO.builder()
.email("[email protected]")
.lastName("Doe").firstName("John")
.build();
RestAssured.given()
.contentType(ContentType.JSON)
.body(dto)
.put("/api/v1/users/pilots")
.then()
.statusCode(201);
}).assertTrue(() -> identityRepository.existsByEmail("[email protected]"));
} The error when launching on pipeline is on the line: And the error is: Maybe the reason is that I'm trying to test every layer (rest, service, repository) on the same test ? Thanks for your help :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I've asked this question on Zulip because I'm affected by a similar situation (combining Panache access and @mkouba pointed out that So I think that your test could be rewritten as: @Test
void testCreatePilotShouldReturn201() {
var dto = CreatePilotDTO.builder()
.email("[email protected]")
.lastName("Doe").firstName("John")
.build();
RestAssured.given()
.contentType(ContentType.JSON)
.body(dto)
.put("/api/v1/users/pilots")
.then()
.statusCode(201);
assertTrue(VertxContextSupport.subscribeAndAwait(() -> Panache.withSession(() -> identityRepository.existsByEmail("[email protected]"))));
} This approach worked for me (no need for |
Beta Was this translation helpful? Give feedback.
I've asked this question on Zulip because I'm affected by a similar situation (combining Panache access and
RestAssured
in the same test).@mkouba pointed out that
io.quarkus.vertx.VertxContextSupport.subscribeAndAwait(Supplier<Uni<T>>)
can be used in a blocking thread to run a non-blocking piece of code with a Vertx context.So I think that your test could be rewritten as: