snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

1.7.0.CR1: TestProfile + TestResource doesn't work in Native tests #152

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 4 years ago

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:

  1. Unzip attached reproducer quarkus_issue.zip

  2. Execute ./mvnw clean verify -Dnative

  3. 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):

Additional context I changed profile for generated native build, as I didn't want it to be default "prod".


https://github.com/quarkusio/quarkus/issues/11146


$upstream:11146$