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

quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script doesn't work with native tests and custom profile #10225

Closed
juangon opened this issue Jun 24, 2020 · 2 comments
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@juangon
Copy link

juangon commented Jun 24, 2020

Describe the bug
When setting a custom profile to execute tests in native mode in application.properties it doesn't work. If changing your custom profile to prod, it works.

Expected behavior
quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script should work properly for custom profiles in native mode.

Actual behavior
Custom settings aren't applied when executing native tests.

To Reproduce
Steps to reproduce the behavior:

  1. Unzip reproducer project (this project uses testcontainers and JPA, hopefully that isn't related).
  2. Execute tests in native mode: ./mvnw verify -Dnative
  3. Check failures stating entity doesn't exist. Looks like custom profile isn't applied.

Configuration

quarkus.datasource.db-kind = mariadb

%test.quarkus.hibernate-orm.database.generation=drop-and-create
%test.quarkus.hibernate-orm.sql-load-script=import_test.sql

%prodnative.quarkus.hibernate-orm.database.generation=drop-and-create
%prodnative.quarkus.hibernate-orm.sql-load-script=import_test.sql

#UNCOMMENT NEXT 2 LINES TO MAKE NATIVE TESTS WORK
#%prod.quarkus.hibernate-orm.database.generation=drop-and-create
#%prod.quarkus.hibernate-orm.sql-load-script=import_test.sql

quarkus.native.additional-build-args =-H:ResourceConfigurationFiles=resources-config.json
quarkus.test.native-image-profile=prodnative

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: 5.3.0-59-generic 53~18.04.1-Ubuntu
  • Output of java -version: 5.3.0-59-generic 53~18.04.1-Ubuntu
  • GraalVM version (if different from Java): 19
  • Quarkus version or git rev: 1.5.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3
    quarkus_issue_reproducer.zip

Additional context
(Add any other context about the problem here.)

@juangon juangon added the kind/bug Something isn't working label Jun 24, 2020
@quarkusbot
Copy link

/cc @gsmet, @Sanne

@quarkusbot quarkusbot added area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE labels Jun 24, 2020
@juangon juangon changed the title quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script doesn't work with custom profile quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script doesn't work with native and custom profile Jun 25, 2020
@juangon juangon changed the title quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script doesn't work with native and custom profile quarkus.hibernate-orm.database.generation and quarkus.hibernate-orm.sql-load-script doesn't work with native tests and custom profile Jun 25, 2020
@famod
Copy link
Member

famod commented Aug 4, 2020

https://quarkus.io/guides/building-native-image#testing-the-native-executable states regarding quarkus.test.native-image-profile:

However, don’t forget that when the native executable is built the prod profile is enabled. So, the profile you enable this way must be compatible with the produced executable.

And since both properties you mentioned are build time properties (see also the lock symbol), you cannot change them the way you are trying to.

So for now this works as designed.

There is some activity in making more Hibernate properties runtime properties, so you are welcome to chime in there: #9275

Feel free to reopen this if you still think this is a bug.

@famod famod closed this as completed Aug 4, 2020
@famod famod added the triage/invalid This doesn't seem right label Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants