Skip to content

Kotlin: Unable to directly invoke suspended service methods that require the Vertx context in unit tests #46361

Open
@aaronz-vipaso

Description

@aaronz-vipaso

Describe the bug

I can't directly call suspended service class methods that access the DB (requires the Vert.x context)

See this reproducer

The test fails because of: io.vertx.core.VertxException: Thread blocked

However, it works fine when the service method is called implicitly by RestAssured over the resource class. Also, refer to the reproducer here.

Expected behavior

I can invoke service class methods that require a Vert.x context from unit tests.

Actual behavior

It hangs. Maybe related to #41288

How to Reproduce?

Reproducer: https://github.com/aaronz-vipaso/quarkus-kotlin-dispatcher

  1. ./gradlew test --tests NameServiceTest – does not work
  2. ./gradlew test --tests NameResourceTest – does work

Output of uname -a or ver

Darwin Aarons-MacBook-Pro.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020 arm64

Output of java -version

openjdk version "17.0.6" 2023-01-17 LTS OpenJDK Runtime Environment Corretto-17.0.6.10.1 (build 17.0.6+10-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.6.10.1 (build 17.0.6+10-LTS, mixed mode, sharing)

Quarkus version or git rev

3.18.3

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------ Gradle 8.12 ------------------------------------------------------------ Build time: 2024-12-20 15:46:53 UTC Revision: a3cacb207fec727859be9354c1937da2e59004c1 Kotlin: 2.0.21 Groovy: 3.0.22 Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024 Launcher JVM: 17.0.6 (Amazon.com Inc. 17.0.6+10-LTS) Daemon JVM: /Users/name/.sdkman/candidates/java/17.0.6-amzn (no JDK specified, using current Java home) OS: Mac OS X 15.1.1 aarch64

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions