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

Debugging underlying service code when using @QuarkusIntegrationTest? #28962

Closed
Manfred73 opened this issue Oct 31, 2022 · 21 comments
Closed

Debugging underlying service code when using @QuarkusIntegrationTest? #28962

Manfred73 opened this issue Oct 31, 2022 · 21 comments
Labels
area/testing kind/question Further information is requested

Comments

@Manfred73
Copy link

Manfred73 commented Oct 31, 2022

Description

Hi,

I have written unittests for my crud service which are annotated with @QuarkusTest. I can easily debug these from within Intellij. For some of these tests I have also written some mockservices using alternatives which are injected instead of the real services.

I've also written some integrationtests, annotated with @QuarkusIntegrationTest. However, when I debug these from Intellij, I'm not able to debug the underlying code. I'm using restassured to post or get some messages and I can debug through the test, but not through the underlying service code itself. Is there a way to also debug the underlying code being called? I've put some system outs in the code, but I dont' see these being logged anywhere.

I've also tried using @QuarkusTest for my integration tests, but then I run into problem again that the mocked services are being used instead of the real services; for my integration tests I want the real services to be used and not the mocks. I think using @QuarkusIntegrationTest is also better to use, because it runs against the native code and we can use the native profile in our build process, which only triggers the integration tests after the native image has been build.

Implementation ideas

No response

@Manfred73 Manfred73 added the kind/enhancement New feature or request label Oct 31, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 31, 2022

/cc @geoand

@geoand geoand added kind/question Further information is requested and removed kind/enhancement New feature or request labels Nov 1, 2022
@geoand
Copy link
Contributor

geoand commented Nov 1, 2022

@QuarkusIntegrationTest runs the application as a black blox. If you are testing the jar and not a container or a native binary, then you can enabled Java debugging via quarkus.test.arg-line=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005

@geoand geoand closed this as completed Nov 1, 2022
@Manfred73
Copy link
Author

I assume this is a property you set in the application.properties?

@geoand
Copy link
Contributor

geoand commented Nov 1, 2022

Exactly

@Manfred73
Copy link
Author

Manfred73 commented Nov 2, 2022

I've added the following to my application-integration.yaml and application-test.yaml:

quarkus:
  test:
    arg-line: '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'

When I now run the test it waits to attach debugger to port 5005. When I attach it, the test continues and I can debug through the test, however, when I do a post (using rest-assured), it doesn't stop at the breakpoint I set in the MyResource. I've also overridden the quarkus profile to use application-integration profile and when starting the test (from within Intellij) I can see it is started with integration profile (see startup command below: -Dquarkus.profile=integration), but it seems it picks up the properties from the application-test.yaml instead of the application-integration.yaml.

This is the output when the test is started:

/usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:37805,suspend=y,server=n -ea -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dmaven.home=/home/mjs02/bin/apache-maven-3.8.6 -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/mjs02/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/plugins/java/lib/rt/debugger-agent.jar=file:/tmp/capture.props -Dfile.encoding=UTF-8 -classpath /home/mjs02/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/lib/idea_rt.jar:/home/mjs02/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/plugins/junit/lib/junit5-rt.jar:/home/mjs02/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/plugins/junit/lib/junit-rt.jar:/home/mjs02/obl/obl-repository-verzuim-rest-service/target/test-classes:/home/mjs02/obl/obl-repository-verzuim-rest-service/target/classes:/home/mjs02/.m2/repository/io/quarkus/quarkus-resteasy-reactive-jackson/2.12.3.Final/quarkus-resteasy-reactive-jackson-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-resteasy-reactive/2.12.3.Final/quarkus-resteasy-reactive-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-resteasy-reactive-common/2.12.3.Final/quarkus-resteasy-reactive-common-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/resteasy/reactive/resteasy-reactive-common/2.12.3.Final/resteasy-reactive-common-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/resteasy/reactive/resteasy-reactive-common-types/2.12.3.Final/resteasy-reactive-common-types-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/resteasy/reactive/resteasy-reactive-vertx/2.12.3.Final/resteasy-reactive-vertx-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.25.0/smallrye-mutiny-vertx-core-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.25.0/smallrye-mutiny-vertx-runtime-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.25.0/vertx-mutiny-generator-2.25.0.jar:/home/mjs02/.m2/repository/io/vertx/vertx-codegen/4.3.2/vertx-codegen-4.3.2.jar:/home/mjs02/.m2/repository/io/quarkus/resteasy/reactive/resteasy-reactive/2.12.3.Final/resteasy-reactive-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-resteasy-reactive-jackson-common/2.12.3.Final/quarkus-resteasy-reactive-jackson-common-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/resteasy/reactive/resteasy-reactive-jackson/2.12.3.Final/resteasy-reactive-jackson-2.12.3.Final.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.3/jackson-databind-2.13.3.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.3/jackson-annotations-2.13.3.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.3/jackson-core-2.13.3.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-jackson/2.12.3.Final/quarkus-jackson-2.12.3.Final.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.3/jackson-datatype-jsr310-2.13.3.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.13.3/jackson-datatype-jdk8-2.13.3.jar:/home/mjs02/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.3/jackson-module-parameter-names-2.13.3.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-arc/2.12.3.Final/quarkus-arc-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/arc/arc/2.12.3.Final/arc-2.12.3.Final.jar:/home/mjs02/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/mjs02/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/mjs02/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/mjs02/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/mjs02/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/mjs02/.m2/repository/org/jboss/logging/jboss-logging/3.5.0.Final/jboss-logging-3.5.0.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-core/2.12.3.Final/quarkus-core-2.12.3.Final.jar:/home/mjs02/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-ide-launcher/2.12.3.Final/quarkus-ide-launcher-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.12.3.Final/quarkus-development-mode-spi-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/config/smallrye-config/2.12.0/smallrye-config-2.12.0.jar:/home/mjs02/.m2/repository/io/smallrye/config/smallrye-config-core/2.12.0/smallrye-config-core-2.12.0.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-expression/1.13.0/smallrye-common-expression-1.13.0.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-function/1.13.0/smallrye-common-function-1.13.0.jar:/home/mjs02/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.10/jboss-logmanager-embedded-1.0.10.jar:/home/mjs02/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/mjs02/.m2/repository/org/jboss/threads/jboss-threads/3.4.3.Final/jboss-threads-3.4.3.Final.jar:/home/mjs02/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/home/mjs02/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/mjs02/.m2/repository/org/graalvm/sdk/graal-sdk/22.2.0/graal-sdk-22.2.0.jar:/home/mjs02/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.12.3.Final/quarkus-bootstrap-runner-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-fs-util/0.0.9/quarkus-fs-util-0.0.9.jar:/home/mjs02/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-hibernate-validator/2.12.3.Final/quarkus-hibernate-validator-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/hibernate/validator/hibernate-validator/6.2.5.Final/hibernate-validator-6.2.5.Final.jar:/home/mjs02/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/mjs02/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/home/mjs02/.m2/repository/org/glassfish/jakarta.el/3.0.4/jakarta.el-3.0.4.jar:/home/mjs02/.m2/repository/io/smallrye/config/smallrye-config-validator/2.12.0/smallrye-config-validator-2.12.0.jar:/home/mjs02/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-smallrye-health/2.12.3.Final/quarkus-smallrye-health-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-health/3.2.1/smallrye-health-3.2.1.jar:/home/mjs02/.m2/repository/org/eclipse/microprofile/health/microprofile-health-api/3.1/microprofile-health-api-3.1.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-health-api/3.2.1/smallrye-health-api-3.2.1.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.13.0/smallrye-common-annotation-1.13.0.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-health-provided-checks/3.2.1/smallrye-health-provided-checks-3.2.1.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-vertx-http/2.12.3.Final/quarkus-vertx-http-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.12.3.Final/quarkus-security-runtime-spi-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-credentials/2.12.3.Final/quarkus-credentials-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-vertx-context/1.13.0/smallrye-common-vertx-context-1.13.0.jar:/home/mjs02/.m2/repository/io/vertx/vertx-core/4.3.2/vertx-core-4.3.2.jar:/home/mjs02/.m2/repository/io/netty/netty-common/4.1.79.Final/netty-common-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-buffer/4.1.79.Final/netty-buffer-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-transport/4.1.79.Final/netty-transport-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-handler/4.1.79.Final/netty-handler-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-transport-native-unix-common/4.1.79.Final/netty-transport-native-unix-common-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-handler-proxy/4.1.79.Final/netty-handler-proxy-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-codec-socks/4.1.79.Final/netty-codec-socks-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-codec-http/4.1.79.Final/netty-codec-http-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-codec-http2/4.1.79.Final/netty-codec-http2-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-resolver/4.1.79.Final/netty-resolver-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-resolver-dns/4.1.79.Final/netty-resolver-dns-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-codec-dns/4.1.79.Final/netty-codec-dns-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.12.3.Final/quarkus-vertx-http-dev-console-runtime-spi-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-vertx/2.12.3.Final/quarkus-vertx-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-netty/2.12.3.Final/quarkus-netty-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/netty/netty-codec/4.1.79.Final/netty-codec-4.1.79.Final.jar:/home/mjs02/.m2/repository/com/aayushatharva/brotli4j/brotli4j/1.7.1/brotli4j-1.7.1.jar:/home/mjs02/.m2/repository/com/aayushatharva/brotli4j/native-linux-x86_64/1.7.1/native-linux-x86_64-1.7.1.jar:/home/mjs02/.m2/repository/io/netty/netty-codec-haproxy/4.1.79.Final/netty-codec-haproxy-4.1.79.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-vertx-latebound-mdc-provider/2.12.3.Final/quarkus-vertx-latebound-mdc-provider-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.5.0/smallrye-fault-tolerance-vertx-5.5.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.25.0/smallrye-mutiny-vertx-web-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.25.0/smallrye-mutiny-vertx-web-common-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.25.0/smallrye-mutiny-vertx-auth-common-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.25.0/smallrye-mutiny-vertx-bridge-common-2.25.0.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-uri-template/2.25.0/smallrye-mutiny-vertx-uri-template-2.25.0.jar:/home/mjs02/.m2/repository/io/vertx/vertx-uri-template/4.3.2/vertx-uri-template-4.3.2.jar:/home/mjs02/.m2/repository/io/vertx/vertx-web/4.3.2/vertx-web-4.3.2.jar:/home/mjs02/.m2/repository/io/vertx/vertx-web-common/4.3.2/vertx-web-common-4.3.2.jar:/home/mjs02/.m2/repository/io/vertx/vertx-auth-common/4.3.2/vertx-auth-common-4.3.2.jar:/home/mjs02/.m2/repository/io/vertx/vertx-bridge-common/4.3.2/vertx-bridge-common-4.3.2.jar:/home/mjs02/.m2/repository/io/github/crac/org-crac/0.1.1/org-crac-0.1.1.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-jsonp/2.12.3.Final/quarkus-jsonp-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-config-yaml/2.12.3.Final/quarkus-config-yaml-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/config/smallrye-config-source-yaml/2.12.0/smallrye-config-source-yaml-2.12.0.jar:/home/mjs02/.m2/repository/org/yaml/snakeyaml/1.32/snakeyaml-1.32.jar:/home/mjs02/.m2/repository/io/smallrye/config/smallrye-config-common/2.12.0/smallrye-config-common-2.12.0.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.13.0/smallrye-common-classloader-1.13.0.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.13.0/smallrye-common-constraint-1.13.0.jar:/home/mjs02/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0.1/microprofile-config-api-2.0.1.jar:/home/mjs02/.m2/repository/org/projectlombok/lombok/1.18.24/lombok-1.18.24.jar:/home/mjs02/.m2/repository/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-junit5/2.12.3.Final/quarkus-junit5-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-bootstrap-core/2.12.3.Final/quarkus-bootstrap-core-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-bootstrap-app-model/2.12.3.Final/quarkus-bootstrap-app-model-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-bootstrap-maven-resolver/2.12.3.Final/quarkus-bootstrap-maven-resolver-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-embedder/3.8.6/maven-embedder-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-settings/3.8.6/maven-settings-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-core/3.8.6/maven-core-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-artifact/3.8.6/maven-artifact-3.8.6.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-component-annotations/2.1.0/plexus-component-annotations-2.1.0.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-plugin-api/3.8.6/maven-plugin-api-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-model/3.8.6/maven-model-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-model-builder/3.8.6/maven-model-builder-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-builder-support/3.8.6/maven-builder-support-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-api/1.6.3/maven-resolver-api-1.6.3.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.6.3/maven-resolver-util-1.6.3.jar:/home/mjs02/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.3.4/maven-shared-utils-3.3.4.jar:/home/mjs02/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/mjs02/.m2/repository/com/google/inject/guice/4.2.2/guice-4.2.2-no_aop.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.6.0/plexus-classworlds-2.6.0.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-sec-dispatcher/2.0/plexus-sec-dispatcher-2.0.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-cipher/2.0/plexus-cipher-2.0.jar:/home/mjs02/.m2/repository/commons-cli/commons-cli/1.4/commons-cli-1.4.jar:/home/mjs02/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.plexus/0.3.5/org.eclipse.sisu.plexus-0.3.5.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-settings-builder/3.8.6/maven-settings-builder-3.8.6.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.26/plexus-interpolation-1.26.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-resolver-provider/3.8.6/maven-resolver-provider-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/maven-repository-metadata/3.8.6/maven-repository-metadata-3.8.6.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-spi/1.6.3/maven-resolver-spi-1.6.3.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-impl/1.6.3/maven-resolver-impl-1.6.3.jar:/home/mjs02/.m2/repository/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-connector-basic/1.6.3/maven-resolver-connector-basic-1.6.3.jar:/home/mjs02/.m2/repository/org/apache/maven/resolver/maven-resolver-transport-wagon/1.6.3/maven-resolver-transport-wagon-1.6.3.jar:/home/mjs02/.m2/repository/org/apache/maven/wagon/wagon-http/3.5.1/wagon-http-3.5.1.jar:/home/mjs02/.m2/repository/org/apache/maven/wagon/wagon-http-shared/3.5.1/wagon-http-shared-3.5.1.jar:/home/mjs02/.m2/repository/org/apache/maven/wagon/wagon-provider-api/3.5.1/wagon-provider-api-3.5.1.jar:/home/mjs02/.m2/repository/org/apache/maven/wagon/wagon-file/3.5.1/wagon-file-3.5.1.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-bootstrap-gradle-resolver/2.12.3.Final/quarkus-bootstrap-gradle-resolver-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/common/smallrye-common-io/1.13.0/smallrye-common-io-1.13.0.jar:/home/mjs02/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.5/org.eclipse.sisu.inject-0.3.5.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-test-common/2.12.3.Final/quarkus-test-common-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-core-deployment/2.12.3.Final/quarkus-core-deployment-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/aesh/readline/2.2/readline-2.2.jar:/home/mjs02/.m2/repository/org/fusesource/jansi/jansi/1.18/jansi-1.18.jar:/home/mjs02/.m2/repository/org/aesh/aesh/2.6/aesh-2.6.jar:/home/mjs02/.m2/repository/io/quarkus/gizmo/gizmo/1.1.0.Final/gizmo-1.1.0.Final.jar:/home/mjs02/.m2/repository/org/ow2/asm/asm-util/9.3/asm-util-9.3.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-class-change-agent/2.12.3.Final/quarkus-class-change-agent-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-devtools-utilities/2.12.3.Final/quarkus-devtools-utilities-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-builder/2.12.3.Final/quarkus-builder-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/junit/platform/junit-platform-launcher/1.9.0/junit-platform-launcher-1.9.0.jar:/home/mjs02/.m2/repository/org/jboss/jandex/2.4.3.Final/jandex-2.4.3.Final.jar:/home/mjs02/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-junit5-properties/2.12.3.Final/quarkus-junit5-properties-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/junit/jupiter/junit-jupiter/5.9.0/junit-jupiter-5.9.0.jar:/home/mjs02/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.9.0/junit-jupiter-params-5.9.0.jar:/home/mjs02/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.9.0/junit-jupiter-engine-5.9.0.jar:/home/mjs02/.m2/repository/org/junit/platform/junit-platform-engine/1.9.0/junit-platform-engine-1.9.0.jar:/home/mjs02/.m2/repository/com/thoughtworks/xstream/xstream/1.4.19/xstream-1.4.19.jar:/home/mjs02/.m2/repository/io/github/x-stream/mxparser/1.2.2/mxparser-1.2.2.jar:/home/mjs02/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-junit5-mockito/2.12.3.Final/quarkus-junit5-mockito-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-junit5-mockito-config/2.12.3.Final/quarkus-junit5-mockito-config-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-arc-deployment/2.12.3.Final/quarkus-arc-deployment-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-spi/2.12.3.Final/quarkus-vertx-http-dev-console-spi-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/quarkus/arc/arc-processor/2.12.3.Final/arc-processor-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/mockito/mockito-core/4.7.0/mockito-core-4.7.0.jar:/home/mjs02/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.13/byte-buddy-agent-1.12.13.jar:/home/mjs02/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-mutiny/2.12.3.Final/quarkus-mutiny-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/mutiny/1.7.0/mutiny-1.7.0.jar:/home/mjs02/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.12.3.Final/quarkus-smallrye-context-propagation-2.12.3.Final.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.2/smallrye-context-propagation-1.2.2.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.2/smallrye-context-propagation-api-1.2.2.jar:/home/mjs02/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.2/smallrye-context-propagation-storage-1.2.2.jar:/home/mjs02/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.7.0/mutiny-smallrye-context-propagation-1.7.0.jar:/home/mjs02/.m2/repository/io/quarkus/quarkus-jacoco/2.12.3.Final/quarkus-jacoco-2.12.3.Final.jar:/home/mjs02/.m2/repository/org/jacoco/org.jacoco.core/0.8.8/org.jacoco.core-0.8.8.jar:/home/mjs02/.m2/repository/org/ow2/asm/asm/9.3/asm-9.3.jar:/home/mjs02/.m2/repository/org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar:/home/mjs02/.m2/repository/org/jacoco/org.jacoco.report/0.8.8/org.jacoco.report-0.8.8.jar:/home/mjs02/.m2/repository/org/jacoco/org.jacoco.agent/0.8.8/org.jacoco.agent-0.8.8.jar:/home/mjs02/.m2/repository/org/jacoco/org.jacoco.agent/0.8.8/org.jacoco.agent-0.8.8-runtime.jar:/home/mjs02/.m2/repository/org/ow2/asm/asm-commons/9.3/asm-commons-9.3.jar:/home/mjs02/.m2/repository/org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar:/home/mjs02/.m2/repository/com/google/jimfs/jimfs/1.2/jimfs-1.2.jar:/home/mjs02/.m2/repository/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar:/home/mjs02/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/home/mjs02/.m2/repository/org/checkerframework/checker-qual/3.24.0/checker-qual-3.24.0.jar:/home/mjs02/.m2/repository/com/google/errorprone/error_prone_annotations/2.15.0/error_prone_annotations-2.15.0.jar:/home/mjs02/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar:/home/mjs02/.m2/repository/org/assertj/assertj-core/3.23.1/assertj-core-3.23.1.jar:/home/mjs02/.m2/repository/net/bytebuddy/byte-buddy/1.12.9/byte-buddy-1.12.9.jar:/home/mjs02/.m2/repository/io/rest-assured/rest-assured/4.5.1/rest-assured-4.5.1.jar:/home/mjs02/.m2/repository/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9.jar:/home/mjs02/.m2/repository/org/codehaus/groovy/groovy-xml/3.0.9/groovy-xml-3.0.9.jar:/home/mjs02/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/mjs02/.m2/repository/org/apache/httpcomponents/httpcore/4.4.15/httpcore-4.4.15.jar:/home/mjs02/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar:/home/mjs02/.m2/repository/org/apache/httpcomponents/httpmime/4.5.13/httpmime-4.5.13.jar:/home/mjs02/.m2/repository/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar:/home/mjs02/.m2/repository/org/ccil/cowan/tagsoup/tagsoup/1.2.1/tagsoup-1.2.1.jar:/home/mjs02/.m2/repository/io/rest-assured/json-path/4.5.1/json-path-4.5.1.jar:/home/mjs02/.m2/repository/org/codehaus/groovy/groovy-json/3.0.9/groovy-json-3.0.9.jar:/home/mjs02/.m2/repository/io/rest-assured/rest-assured-common/4.5.1/rest-assured-common-4.5.1.jar:/home/mjs02/.m2/repository/io/rest-assured/xml-path/4.5.1/xml-path-4.5.1.jar:/home/mjs02/obl/obl-architecture-tests/target/classes:/home/mjs02/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.9.0/junit-jupiter-api-5.9.0.jar:/home/mjs02/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/mjs02/.m2/repository/org/junit/platform/junit-platform-commons/1.9.0/junit-platform-commons-1.9.0.jar:/home/mjs02/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/mjs02/.m2/repository/com/tngtech/archunit/archunit-junit5/1.0.0/archunit-junit5-1.0.0.jar:/home/mjs02/.m2/repository/com/tngtech/archunit/archunit-junit5-api/1.0.0/archunit-junit5-api-1.0.0.jar:/home/mjs02/.m2/repository/com/tngtech/archunit/archunit/1.0.0/archunit-1.0.0.jar:/home/mjs02/.m2/repository/com/tngtech/archunit/archunit-junit5-engine/1.0.0/archunit-junit5-engine-1.0.0.jar:/home/mjs02/.m2/repository/com/tngtech/archunit/archunit-junit5-engine-api/1.0.0/archunit-junit5-engine-api-1.0.0.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 nl.mycompany.integrationtests.MyResourceIT,expect_response_with_status_200_when_calling_post_method_with_filename_and_file
Connected to the target VM, address: '127.0.0.1:37805', transport: 'socket'
Executing "/usr/lib/jvm/java-17-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/home/mjs02/projects/file-rest-service/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.configuration.build-time-mismatch-at-runtime=fail -Dquarkus.profile=integration -Dfiles.location=/tmp/files_integration_test -jar /home/mjs02/projects/file-rest-service/target/quarkus-app/quarkus-run.jar"
Listening for transport dt_socket at address: 5005

I have a test like this where I override application.yaml with application-integration.yaml and specific property I want to override from that application-integration.yaml: files.location:

@QuarkusIntegrationTest
@TestHTTPEndpoint(MyResource.class)
@TestProfile(MyResourceIT.BuildTimeValueChangeTestProfile.class)
public class MyResourceIT {

   @Test
   void expect_response_with_status_200_when_calling_post_method_with_filename_and_file {
      given()
         .multiPart("file", fileToPost)
         .formParam("filename", fileOut)
         .when()
         .post("/v1/files")
         .then()
         .statusCode(200)
         .body(emptyString());
   }

   public static class BuildTimeValueChangeTestProfile implements QuarkusTestProfile {

      @Override
      public String getConfigProfile() {
         return "integration";
      }

      @Override
      public Map<String, String> getConfigOverrides() {
         return Collections.singletonMap("files.location", "/alternative_path_for_integrationtesting");
      }
   }
}

Then in MyResource class I have something like:

@Path("/v1/files")
public class MyResource {

   @Inject
   ValidationService validationService;

   @Inject
   FileService fileService

   @Inject
   ResultCreator resultCreator;

   @POST
   @Consumes(MediaType.MULTIPART_FORM_DATA)
   @Produces(MediaType.TEXT_PLAIN)
   public Response saveFile(@Valid @MultipartForm FileRequest fileRequest) {
      Log.info("saveFile with filename + fileRequest.getFilename());
      validationService.validate(fileRequest);
      fileService.saveFile(fileRequest);
      return resultCreator.create();
   }
}

And the application-integration.yaml:

files:
  location: /my_file_location

quarkus:
  test:
    arg-line: '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
  log:
    level: INFO
    console:
      enable: true
    file:
      enable: true
      path: /tmp/logs/integration/files-repository

Furthermore I have an application-test.yaml which is differently configured and should write logs to another directory:

files:
  location: /my_file_location

quarkus:
  test:
    arg-line: '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
  log:
    level: INFO
    console:
      enable: true
    file:
      enable: true
      path: /tmp/logs/test/files-repository

When I leave out the test.arg-line option from both application-test.yaml and application-integration.yaml, it doesn't wait at port 5005 to attach the debugger (as expected). When I add it to application-integration.yaml it doesn't wait either, whereas I would expect it to wait since I run with integration profile. When I add it to application-test.yaml it does wait. So this tells me that the @QuarkusIntegrationTest does not pick up the integration profile.
So how can I make sure it picks the right profile and that I can debug the underlying MyResource class when the post is done from the integrationtest?

I've tried adding info logging in MyResource, but these are somehow not visible in the log files when running a test with @QuarkusIntegrationTest. I've made another comment about this on issue #20303.

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

One thing worth noting is that @QuarkusIntegrationTest runs the application with the prod profile (although there is discussion of changing this).
That means that application.yaml should be used for configuring it (or setting system properties)

@Manfred73
Copy link
Author

Manfred73 commented Nov 2, 2022

Oh, that changes things. Now I may have an idea why my test fails and cannot find the file location ;-)
Would still help if somehow I was able to debug the real code being executed or log messages to show up in the log.

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

:)

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

although there is discussion of changing this

#24581 is the issue if want to chime in

@Manfred73
Copy link
Author

Although this issue was also more about being able to debug the application. I'm still not able to get into the underlying code.

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

I just tried it and it works.

Essentially if there the failsafe plugin is configured, then the integration tests will run and using quarkus.test.arg-line=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 makes Quarkus launch the jar (assuming you are testing the jar and not some other artifact) like so:

Executing "/home/gandrian/.sdkman/candidates/java/17.0.4.1-tem/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/home/gandrian/projects/redhat/quarkus-quickstarts/getting-started/target/quarkus.log -Dquarkus.log.file.enable=true -jar /home/gandrian/projects/redhat/quarkus-quickstarts/getting-started/target/quarkus-app/quarkus-run.jar"
Listening for transport dt_socket at address: 5005

Attaching a remote debugging session to port 5005 will allow you to debug the application itself and not the tests

@Manfred73
Copy link
Author

OK, but when I have an integrationtest that posts something to my service and something goes wrong because of some misconfiguration. How will I be able to debug that?

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

What I mentioned above will allow you to debug the application itself. If you need to debug the tests as well, then you'll need to run mvn verify -Dmaven.failsafe.debug and connect a remote debugging session to port 5005.

This means that you should then change quarkus.test.arg-line to agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5006 in order to avoid debugging port conflicts and connect the remote debugger for the application to port 5006

@Manfred73
Copy link
Author

I'm running the integrationtest from Intellij IDE in debug (not using mvn command line). That works fine and I can debug the test that way.

In the prod application.yaml I've set the quarkus.test.arg-line (using port 5006). When I run the test, it asks to attach debugger. Then test continues, but it doesn't stop at the breakpoints in the application.

The @QuarkusIntegrationTest does pick up the arg-line from the prod application.yaml, but it ignores the log settings from that. Instead it uses the log settings from the application-test.yaml.

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

I'm running the integrationtest from Intellij IDE in debug (not using mvn command line). That works fine and I can debug the test that way.

You will still need a remote debugging session for connecting to the application itself.

@Manfred73
Copy link
Author

Isn't that what I'm doing by setting the quarkus.test.arg-line in application.yaml? Or is that for test only?

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

My point is that hitting debug in IntelliJ will only allow you to debug the test itself - it will not be sufficient to debug the application as the application itself runs in another process (which is the whole point of @QuarkusIntegrationTest)

@Manfred73
Copy link
Author

OK, managed to get debugging working. Forgot to change port number in my initial configuration.

@geoand
Copy link
Contributor

geoand commented Nov 2, 2022

👌🏼

@Manfred73
Copy link
Author

And the reason for not coming into underlying sourcecode for one particular IT test I mentioned here:

The test uses the resource path from the real class as follows:

@TestHTTPEndpoint(MyResource.class)

In my integration test I did a post:

..........
post("/v1/files")
..........

So I actually did a post("/v1/files/v1/files") instead of post("/v1/files").
No wonder it didn't stop in the real code, since it never came there.

@Manfred73
Copy link
Author

Manfred73 commented Nov 2, 2022

One thing worth noting is that @QuarkusIntegrationTest runs the application with the prod profile (although there is discussion of changing this).
That means that application.yaml should be used for configuring it (or setting system properties)

This seems not to be entirely true though.
When you have an application-test.yaml, then @QuarkusIntegrationTest takes its values from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants