2
votes

Is there any support for different test profiles? During my local tests I would like to use "mvn package" which uses the "test" profile. This points to my localhost db. For my devops toolchain I want to use a different test profile because we are using containers and cannot use localhost. Goal is to distinguish between local machine test and cloud env. test.

3

3 Answers

1
votes

you mean you run 'mvn packge' which leads to the tests being run - like with 'mvn test' . In this case @QuarkusTest tests will run with the 'test' profile. The same goes for running tests in the ide.

There is a system property (used with '-D') 'quarkus.test.profile'. It leads to this profile being activated:

mvn test -Dquarkus.test.profile=foo
.....
2020-04-10 14:06:20,451 INFO  [io.quarkus] (main) Quarkus 1.3.0.Final started in 17.408s. Listening on: http://0.0.0.0:8081
2020-04-10 14:06:20,451 INFO  [io.quarkus] (main) Profile foo activated. 

You may set this property on the surefire or failsafe plugin in your pom.xml (see 1).

You may also set this property within your IDE on a run/launch configuration to start the test (IntelliJ: use the vm options field and add '-Dquarkus.test.profile=integrate')

https://quarkus.io/guides/maven-tooling

0
votes

Quarkus supports custom profiles. You have two ways to set a custom profile: via the quarkus-profile system property or the QUARKUS_PROFILE environment variable.

For your needs, you can for example, use a 'staging' profile with a different db address in application.properties in this way:

%staging.db.address=value

And set the QUARKUS_PROFILE environment variable to staging to activate the profile.

0
votes

you can use quarkus.profile property so at runtime it will be:mvn package -Dquarkus.profile=your_custom_profile