quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.75k stars 2.67k forks source link

Kubernetes manifests are not generated when using QuarkusProdModeTest #36041

Open metacosm opened 1 year ago

metacosm commented 1 year ago

Describe the bug

I'm seeing the following error message when running my tests from maven: 2023-09-20 14:19:44,884 WARN [io.qua.kub.dep.KubernetesProcessor] (build-5) No project was detected, skipping generation of kubernetes manifests!

Adding additional information to Quarkus itself, the issue seems to come from dekorate:

java.lang.IllegalStateException: Could not find matching project info read
        at io.dekorate.project.FileProjectFactory.lambda$createInternal$0(FileProjectFactory.java:64)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at io.dekorate.project.FileProjectFactory.createInternal(FileProjectFactory.java:64)
        at io.dekorate.project.FileProjectFactory.create(FileProjectFactory.java:44)
        at io.quarkus.kubernetes.deployment.KubernetesCommonHelper.createProject(KubernetesCommonHelper.java:129)
        at io.quarkus.kubernetes.deployment.KubernetesProcessor.build(KubernetesProcessor.java:140)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at java.base/java.lang.Thread.run(Thread.java:1623)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Of note, this only occurs when running the tests from my typical maven build. If I run the tests from my IDE (to debug them, for example), then everything works as expected.

Expected behavior

Tests should behave the same way wherever they are executed.

Actual behavior

Kubernetes manifests are not generated when they should really be.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.2.6.Final

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

No response

Additional information

No response

quarkus-bot[bot] commented 1 year ago

/cc @geoand (kubernetes), @iocanel (kubernetes)

iocanel commented 1 year ago

@metacosm: The tests we use to test the generation process are mostly QuarkusProdModeTest, so I am wondering if there is something in your setup that triggers it. Do you have a reproducer?

metacosm commented 1 year ago

Yes: https://github.com/quarkiverse/quarkus-operator-sdk/blob/ae02ea7811fa3687d4fb6693c3f9e85444b125d9/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/MultipleOperatorsBundleTest.java

For that matter, you can see the issue with the tests for the bundle-generator/deployment in main as well.

iocanel commented 1 year ago

I can't reproduce. I used the main branch but it worked fine. I also used the main branch + the code from the commit you provided.

In both cases things worked just fine.

metacosm commented 1 year ago

What do you mean by "things worked fine"? You didn't get the warning or did the tests pass? Note that the exception never actually shows up: you need to debug to see it happen (or change the code in a way similar to https://github.com/quarkusio/quarkus/pull/36057) so the only thing that should be "wrong" with main or the commit would be that the kubernetes manifests are not generated, the warning shows up but the tests are passing because they currently avoid testing things where things actually fails because the kubernetes manifests are not properly generated.