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

Error occurs on tests with @Nested classes and QuarkusMainLauncher #46136

Closed
benDeMtp opened this issue Feb 7, 2025 · 1 comment · Fixed by #46150
Closed

Error occurs on tests with @Nested classes and QuarkusMainLauncher #46136

benDeMtp opened this issue Feb 7, 2025 · 1 comment · Fixed by #46150
Labels
area/testing kind/bug Something isn't working
Milestone

Comments

@benDeMtp
Copy link

benDeMtp commented Feb 7, 2025

Describe the bug

On a quarkus cli app, when tests contains 2 or more nested classes and QuarkusMainLauncher#lauch() is called in a nested classe, tests throws an Error:

@QuarkusMainTest
public class GreetingCommandTest {

    @Test
    void test1(){
        assertTrue(true);
    }

    @Nested
    class Nested1{

        @Test
        void test2(){
            assertTrue(true);
        }
    }

    @Nested
    class Nested2{

        @Test
        void test3(QuarkusMainLauncher launcher){
            LaunchResult result = launcher.launch("-h");
            assertTrue(true);
        }
    }

}
java.util.ServiceConfigurationError: io.smallrye.config.SmallRyeConfigBuilderCustomizer: io.quarkus.deployment.configuration.BuildTimeConfigBuilderCustomizer not a subtype
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
        at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:757)
        at io.quarkus.deployment.configuration.BuildTimeConfigurationReader.initConfiguration(BuildTimeConfigurationReader.java:412)
        at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:141)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:107)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:350)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:271)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:61)
        at io.quarkus.test.junit.QuarkusMainTestExtension.doJavaStart(QuarkusMainTestExtension.java:183)
        at io.quarkus.test.junit.QuarkusMainTestExtension.doLaunch(QuarkusMainTestExtension.java:95)
        at io.quarkus.test.junit.QuarkusMainTestExtension$2.launch(QuarkusMainTestExtension.java:263)
        at org.acme.GreetingCommandTest$Nested2.test3(GreetingCommandTest.java:35)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.test.junit.QuarkusMainTestExtension.interceptTestMethod(QuarkusMainTestExtension.java:303)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

The error occurs when there is :

  • 2 Nested classes or more
  • launcher.launch() called in a nested class

There is no error if :

  • there is only one nested class,
  • or if launcher.launch() is not called in an nested class.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

https://github.com/benDeMtp/nested-bug-reproducer

Output of uname -a or ver

Darwin Kernel Version 24.2.0

Output of java -version

openjdk version "21.0.5" 2024-10-15 LTS

Quarkus version or git rev

3.18.2

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

Apache Maven 3.9.9

Additional information

No response

@benDeMtp benDeMtp added the kind/bug Something isn't working label Feb 7, 2025
@benDeMtp benDeMtp changed the title Error occurred on tests with @Nested classes and QuarkusMainLauncher Error occurs on tests with @Nested classes and QuarkusMainLauncher Feb 7, 2025
@gsmet gsmet closed this as completed in 575e885 Feb 8, 2025
gsmet added a commit that referenced this issue Feb 8, 2025
Overcome augmentation issue with @nested QuarkusMainTest
@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Feb 8, 2025
@gsmet
Copy link
Member

gsmet commented Feb 8, 2025

Thanks for the detailed report and the reproducer! The fix will get backported to next 3.18.

@gsmet gsmet modified the milestones: 3.19 - main, 3.18.3 Feb 11, 2025
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 11, 2025
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

Successfully merging a pull request may close this issue.

3 participants