diff --git a/integration-tests/hibernate-orm-tenancy/datasource/README.md b/integration-tests/hibernate-orm-tenancy/datasource/README.md index 2bca5f5173f79..1f752bfdf5d78 100644 --- a/integration-tests/hibernate-orm-tenancy/datasource/README.md +++ b/integration-tests/hibernate-orm-tenancy/datasource/README.md @@ -19,7 +19,9 @@ Additionally, you can generate a native image and run the tests for this native mvn clean install -Dtest-containers -Dstart-containers -Dnative ``` -If you don't want to run MariaDB as a Docker container, you can start your own MariaDB server. It needs to listen on the default port and have a database called `hibernate_orm_test` and a root user with the password `secret`. +If you don't want to run MariaDB as a Docker container, you can start your own MariaDB server. +It needs to listen on the default port and have a database called `hibernate_orm_test` and a root user with the password `secret`, +and it needs to be initialized with the SQL script found at `custom-mariadbconfig/init.sql`. You can then run the tests as follows (either with `-Dnative` or not): @@ -34,18 +36,20 @@ should not include the database name: check the `application.properties` to see To run the MariaDB server "manually" via command line for testing, the following command line could be useful: ``` -docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_test_mariadb -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 mariadb:10.4 +docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_test_mariadb -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=secret -p 3308:3306 mariadb:10.4 ``` or if you prefer podman, this won't need root permissions: ``` -podman run --rm=true --net=host --memory-swappiness=0 --tmpfs /var/lib/mysql:rw --tmpfs /var/log:rw --name mariadb_demo -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 mariadb:10.4 +podman run --rm=true --net=host --memory-swappiness=0 --tmpfs /var/lib/mysql:rw --tmpfs /var/log:rw --name mariadb_demo -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=secret -p 3308:3306 mariadb:10.4 ``` N.B. it takes a while for MariaDB to be actually booted and accepting connections. -After it's fully booted, you can run all integration tests via +After it's fully booted you will then need to initialize the database with the SQL script found at `custom-mariadbconfig/init.sql`. + +Once that's done, you can run all integration tests via: ``` mvn clean install -Dtest-containers -Dnative diff --git a/integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/database/default/V1.0.0__init_databases.sql b/integration-tests/hibernate-orm-tenancy/datasource/custom-mariadbconfig/init.sql similarity index 100% rename from integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/database/default/V1.0.0__init_databases.sql rename to integration-tests/hibernate-orm-tenancy/datasource/custom-mariadbconfig/init.sql diff --git a/integration-tests/hibernate-orm-tenancy/datasource/pom.xml b/integration-tests/hibernate-orm-tenancy/datasource/pom.xml index dfb525d6e808b..432e4b342aba5 100644 --- a/integration-tests/hibernate-orm-tenancy/datasource/pom.xml +++ b/integration-tests/hibernate-orm-tenancy/datasource/pom.xml @@ -251,6 +251,10 @@ true + + true + bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret </etc/mysql/conf.d/init.sql + diff --git a/integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/application.properties b/integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/application.properties index 61361b4b3ffcb..26a52d4e86e32 100644 --- a/integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/application.properties +++ b/integration-tests/hibernate-orm-tenancy/datasource/src/main/resources/application.properties @@ -3,17 +3,6 @@ quarkus.hibernate-orm.database.generation=none quarkus.hibernate-orm.multitenant=database quarkus.hibernate-orm.packages=io.quarkus.it.hibernate.multitenancy.fruit -# Default DB Configuration -quarkus.datasource.db-kind=mariadb -quarkus.datasource.username=root -quarkus.datasource.password=secret -quarkus.datasource.jdbc.url=${mariadb.base_url}/hibernate_orm_test -quarkus.datasource.jdbc.max-size=1 -quarkus.flyway.migrate-at-start=true -#Reset Flyway metadata at boot, as the database might have been tainted by previous integration tests: -quarkus.flyway.clean-at-start=true -quarkus.flyway.locations=classpath:database/default - # DATABASE Tenant 'base' Configuration quarkus.datasource.base.db-kind=mariadb quarkus.datasource.base.username=jane