Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestResources are not stopped when using @QuarkusMainTest and @Launch #26882

Closed
benoit-messager opened this issue Jul 22, 2022 · 1 comment
Closed
Labels
area/testing kind/bug Something isn't working

Comments

@benoit-messager
Copy link

benoit-messager commented Jul 22, 2022

Describe the bug

Considering this test :

@QuarkusMainTest
@QuarkusTestResource(DummyTestResource::class)
open class RetryCardCreationRequestBatchTest {

    @Test
    @Launch(value = [])
    fun `should stop test resource`(result: LaunchResult?) {
        result!!.exitCode() shouldBe 0
    }
}

And this test resource :

class DummyTestResource: QuarkusTestResourceLifecycleManager {
    override fun start(): MutableMap<String, String> {
        println("Started")
        return emptyMap<String, String>().toMutableMap()
    }

    override fun stop() {
        println("Stopped")
    }
}

The output is :

2022-07-22 10:51:39,102 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
Started
2022-07-22 10:51:41,301 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-07-22 10:51:41,983 INFO  [io.quarkus] (main) batch 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.9.2.Final) started in 3.667s. Listening on: http://localhost:8081
2022-07-22 10:51:41,983 INFO  [io.quarkus] (main) Profile test activated. 
2022-07-22 10:51:41,984 INFO  [io.quarkus] (main) Installed features: [amazon-dynamodb, cdi, config-yaml, jacoco, kotlin, logging-json, rest-client, smallrye-context-propagation, smallrye-health, vertx]
2022-07-22 10:51:41,985 INFO  [com.snc.ter.nae.car.RetryCardCreationRequestBatch] (main) Test
2022-07-22 10:51:42,009 INFO  [io.quarkus] (main) batch stopped in 0.023s

The test resource stop() method is not called

Expected behavior

Stop method of test resource is called

Actual behavior

Stop method of test resource is not called

How to Reproduce?

No response

Output of uname -a or ver

Darwin LM-C02ZC045L415 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "17.0.1" 2021-10-19 LTS OpenJDK Runtime Environment Corretto-17.0.1.12.1 (build 17.0.1+12-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.1.12.1 (build 17.0.1+12-LTS, mixed mode, sharing)

GraalVM version (if different from Java)

22.1.0

Quarkus version or git rev

2.9.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

No response

@benoit-messager benoit-messager added the kind/bug Something isn't working label Jul 22, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 22, 2022

/cc @evanchooly

@gsmet gsmet closed this as completed in ef00fec Jul 26, 2022
gsmet added a commit that referenced this issue Jul 26, 2022
Fix test resource close issues in command mode tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants