quarkus: 1.7.0.CR1: TestProfile + TestResource doesn't work in Native tests
Describe the bug As I wanted to separate native and “normal” tests, I made two TestProfiles, each of them have a custom TestResource with a MariaDB container (using testcontainers) on them. Each MariaDB has their own schema name etc (I changed it as I’ve seen native tests are using the same schema and container as normal tests) .
First issue came when I tried to set jdbc parameters for native tests in their own TestResource, it doesn’t work. Second issue, when setting them manually in “application.properties”, it doesn’t connect.
So, it looks like TestResources doesn’t work on native tests. MariaDB container for native tests isn’t used or started.
Expected behavior
Custom parameters set in TestResource for native tests are applied. Custom TestResource for native tests are started and used.
Actual behavior
Neither parameters nor container is started in native tests.
To Reproduce Steps to reproduce the behavior:
-
Unzip attached reproducer quarkus_issue.zip
-
Execute ./mvnw clean verify -Dnative
-
Look native tests failing as it can’t connect to native test resource, which is a testcontainer’s Maria DB.
Configuration
# DATASOURCE
quarkus.datasource.db-kind = mariadb
quarkus.datasource.username = normal
quarkus.datasource.password = normal
quarkus.datasource.jdbc.url = jdbc:mysql://localhost/normal
%test.quarkus.hibernate-orm.database.generation=drop-and-create
%test.quarkus.hibernate-orm.sql-load-script =import_test.sql
%nativetest.quarkus.datasource.username = nativetest
%nativetest.quarkus.datasource.password = nativetest
%nativetest.quarkus.hibernate-orm.database.generation=drop-and-create
%nativetest.quarkus.hibernate-orm.sql-load-script =import_test.sql
quarkus.native.additional-build-args =\
-H:ResourceConfigurationFiles=resources-config.json
quarkus.test.native-image-profile=nativetest
Screenshots (If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
- Output of
uname -a
orver
: 5.4.0-42-generic - Output of
java -version
: openjdk version “11.0.8” 2020-07-14 - GraalVM version (if different from Java):
- Quarkus version or git rev: 1.7.0.CR1
- Build tool (ie. output of
mvnw --version
orgradlew --version
): Apache Maven 3.6.3
Additional context I changed profile for generated native build, as I didn’t want it to be default “prod”.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Explicitly prevent the use of `@TestProfile` with @NativeImageTest Fixes: #11146 — committed to geoand/quarkus by geoand 4 years ago
- Explicitly prevent the use of `@TestProfile` with @NativeImageTest Fixes: #11146 — committed to geoand/quarkus by geoand 4 years ago
- Merge pull request #11150 from geoand/#11146 Explicitly prevent the use of @TestProfile with @NativeImageTest — committed to quarkusio/quarkus by geoand 4 years ago
- Explicitly prevent the use of `@TestProfile` with @NativeImageTest Fixes: #11146 — committed to gsmet/quarkus by geoand 4 years ago
@famod thanks very much for the info and that hibernate link.