Closed josephearl closed 1 year ago
/cc @geoand (testing)
What exactly are you trying to do that requires the test itself to run in a specific profile?
When I run the test locally I want dev-services for test dependencies, so some property e.g. JDBC URL needs to not be set.
When I run the test on CI I don't want dev-services, so I need to activate a different profile for the test that has the property set so that dev services do not start.
So I need to run the test itself under different profiles.
So it's the application itself that needs to have a specific profile, not the test.
Both, the application profile doesn't determine whether dev services are started or not (as far as I can gather, otherwise my test would work). And it is possible to change the profile the application uses with quarkus.test.integration-test-profile
.
My config looks something like:
quarkus.package.type=native
quarkus.native.remote-container-build=true
quarkus.container-image.build=true
quarkus.some.devservices.port=10616
%ci.quarkus.package.type=uber-jar
%ci.quarkus.native.remote-container-build=false
%ci.quarkus.container-image.build=false
%ci.quarkus.some.url=${SOME_URL}
%ci.quarkus.some.username=${SOME_USER}
%ci.quarkus.some.password=${SOME_PASSWORD}
When I run tests on CI with -Dquarkus.test.profile=ci -Dquarkus.test.integration-test-profile=ci
I find that the application starts up with ci
profile but the test runs under the test
profile, so it doesn't see that quarkus.some.url
is set, and starts the dev services for that dependency (and that fails because my CI doesn't support starting containers)
My bad - it turns out you can change the profile @QuarkusIntegrationTest
s run under with quarkus.test.profile
.
When using Gradle however you need something like:
quarkusIntTest {
systemProperty 'quarkus.test.profile', System.getProperty('quarkus.test.profile') ?: 'test'
}
Otherwise the system property specified on the command line with -Dquarkus.test.profile
is not passed to the forked JVM used for running tests
Describe the bug
I have a
@QuarkusIntegrationTest
. I need to run this test under a different profile on CI - basically I want to use testcontainers/devservices for the integration test when running locally, but not have these start on CI because the build is already in a container (and provides the needed dependencies).When I run
./gradlew quarkusIntTest -Dquarkus.test.profile=ci -Dquarkus.test.integration-test-profile=ci
The application starts up with the
ci
profile, but the test itself runs under thetest
profile (checked by printing the value ofConfigUtils.getProfiles()
at the start of my test).This prevents me from running the test itself under different profiles.
Expected behavior
I can change the test profile for
@QuarkusIntegrationTest
.I (naively) expected
quarkus.test.integration-test-profile
to affect the profile of both the application and the test, whereas it just seems to affect the application meaning the test and application are running separate/disconnected profiles.Failing that (if the ability to run the application and the test under different profiles is desired) then I would expect
quarkus.test.profile
to affect the profile the integration test itself runs under.Actual behavior
@QuarkusIntegrationTest
tests always seems to run under thetest
profile, regardless of configuration applied.How to Reproduce?
No response
Output of
uname -a
orver
Darwin Kernel Version 22.5.0
Output of
java -version
17.0.7
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.2.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.2
Additional information
No response