From 72386e3e402987e4bd875a5031bb8f0cfbc35329 Mon Sep 17 00:00:00 2001 From: Falko Modler Date: Mon, 31 Jan 2022 23:48:19 +0100 Subject: [PATCH] Update MariaDB image to 10.6 for integration tests and dev services --- build-parent/pom.xml | 2 +- extensions/devservices/common/pom.xml | 9 +++++++ .../devservices/common/ConfigureUtil.java | 27 +++++++++++++++++++ .../src/main/resources/devservices.properties | 1 + .../MariaDBDevServicesProcessor.java | 5 ++-- .../hibernate/orm/deployment/Dialects.java | 2 +- .../orm/deployment/ConstantsTest.java | 4 +-- .../src/main/resources/application.properties | 4 +-- .../src/main/resources/application.properties | 4 +-- .../main/resources/META-INF/persistence.xml | 2 +- 10 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 extensions/devservices/common/src/main/resources/devservices.properties diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 050c681fcc03e..12505e0b3f629 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -85,7 +85,7 @@ docker.io/postgres:14.1 - docker.io/mariadb:10.4 + docker.io/mariadb:10.6 docker.io/ibmcom/db2:11.5.5.0 mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04 docker.io/gvenzl/oracle-xe:21.3.0-slim diff --git a/extensions/devservices/common/pom.xml b/extensions/devservices/common/pom.xml index 0bfc2c543a11d..6e95538d213ed 100644 --- a/extensions/devservices/common/pom.xml +++ b/extensions/devservices/common/pom.xml @@ -40,4 +40,13 @@ quarkus-core + + + + + src/main/resources + true + + + diff --git a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/ConfigureUtil.java b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/ConfigureUtil.java index c39178e9f34f3..23401eecc139e 100644 --- a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/ConfigureUtil.java +++ b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/ConfigureUtil.java @@ -1,6 +1,10 @@ package io.quarkus.devservices.common; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; import java.util.Collections; +import java.util.Properties; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; @@ -38,4 +42,27 @@ public static String configureSharedNetwork(GenericContainer container, Strin return hostName; } + + public static String getDefaultImageNameFor(String devserviceName) { + var imageName = LazyProperties.INSTANCE.getProperty(devserviceName + ".image"); + if (imageName == null) { + throw new IllegalArgumentException("No default image configured for " + devserviceName); + } + return imageName; + } + + private static class LazyProperties { + + private static final Properties INSTANCE; + + static { + var tccl = Thread.currentThread().getContextClassLoader(); + try (InputStream in = tccl.getResourceAsStream("devservices.properties")) { + INSTANCE = new Properties(); + INSTANCE.load(in); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + } } diff --git a/extensions/devservices/common/src/main/resources/devservices.properties b/extensions/devservices/common/src/main/resources/devservices.properties new file mode 100644 index 0000000000000..bb5d7f35bc0b3 --- /dev/null +++ b/extensions/devservices/common/src/main/resources/devservices.properties @@ -0,0 +1 @@ +mariadb.image=${mariadb.image} diff --git a/extensions/devservices/mariadb/src/main/java/io/quarkus/devservices/mariadb/deployment/MariaDBDevServicesProcessor.java b/extensions/devservices/mariadb/src/main/java/io/quarkus/devservices/mariadb/deployment/MariaDBDevServicesProcessor.java index ba26d1e5d5675..acbc20871749b 100644 --- a/extensions/devservices/mariadb/src/main/java/io/quarkus/devservices/mariadb/deployment/MariaDBDevServicesProcessor.java +++ b/extensions/devservices/mariadb/src/main/java/io/quarkus/devservices/mariadb/deployment/MariaDBDevServicesProcessor.java @@ -24,7 +24,6 @@ public class MariaDBDevServicesProcessor { private static final Logger LOG = Logger.getLogger(MariaDBDevServicesProcessor.class); - public static final String TAG = "10.5.9"; public static final Integer PORT = 3306; public static final String MY_CNF_CONFIG_OVERRIDE_PARAM_NAME = "TC_MY_CNF"; @@ -75,8 +74,8 @@ private static class QuarkusMariaDBContainer extends MariaDBContainer { public QuarkusMariaDBContainer(Optional imageName, OptionalInt fixedExposedPort, boolean useSharedNetwork) { super(DockerImageName - .parse(imageName.orElse("docker.io/" + MariaDBContainer.IMAGE + ":" + MariaDBDevServicesProcessor.TAG)) - .asCompatibleSubstituteFor(DockerImageName.parse(MariaDBContainer.IMAGE))); + .parse(imageName.orElseGet(() -> ConfigureUtil.getDefaultImageNameFor("mariadb"))) + .asCompatibleSubstituteFor(DockerImageName.parse(MariaDBContainer.NAME))); this.fixedExposedPort = fixedExposedPort; this.useSharedNetwork = useSharedNetwork; } diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/Dialects.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/Dialects.java index 4a558998a470d..7a44b846773fd 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/Dialects.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/Dialects.java @@ -23,7 +23,7 @@ public static String guessDialect(String persistenceUnitName, String resolvedDbK return "io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect"; } if (DatabaseKind.isMariaDB(resolvedDbKind)) { - return "org.hibernate.dialect.MariaDB103Dialect"; + return "org.hibernate.dialect.MariaDB106Dialect"; } if (DatabaseKind.isMySQL(resolvedDbKind)) { return "org.hibernate.dialect.MySQL8Dialect"; diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ConstantsTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ConstantsTest.java index 57ae174cabd71..696f693ba0166 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ConstantsTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ConstantsTest.java @@ -6,7 +6,7 @@ import org.hibernate.dialect.DB297Dialect; import org.hibernate.dialect.DerbyTenSevenDialect; -import org.hibernate.dialect.MariaDB103Dialect; +import org.hibernate.dialect.MariaDB106Dialect; import org.hibernate.dialect.MySQL8Dialect; import org.hibernate.dialect.Oracle12cDialect; import org.hibernate.dialect.SQLServer2016Dialect; @@ -38,7 +38,7 @@ public void testDialectNames() { assertDialectMatch(DatabaseKind.DB2, DB297Dialect.class); assertDialectMatch(DatabaseKind.POSTGRESQL, QuarkusPostgreSQL10Dialect.class); assertDialectMatch(DatabaseKind.H2, QuarkusH2Dialect.class); - assertDialectMatch(DatabaseKind.MARIADB, MariaDB103Dialect.class); + assertDialectMatch(DatabaseKind.MARIADB, MariaDB106Dialect.class); assertDialectMatch(DatabaseKind.MYSQL, MySQL8Dialect.class); assertDialectMatch(DatabaseKind.DERBY, DerbyTenSevenDialect.class); assertDialectMatch(DatabaseKind.MSSQL, SQLServer2016Dialect.class); diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/resources/application.properties b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/resources/application.properties index cff2e2163f972..259054f66958b 100644 --- a/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/resources/application.properties +++ b/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/resources/application.properties @@ -1,7 +1,7 @@ # Hibernate ORM settings quarkus.hibernate-orm.database.generation=none quarkus.hibernate-orm.multitenant=database -quarkus.hibernate-orm.dialect=org.hibernate.dialect.MariaDB103Dialect +quarkus.hibernate-orm.dialect=org.hibernate.dialect.MariaDB106Dialect quarkus.hibernate-orm.packages=io.quarkus.it.hibernate.multitenancy.fruit # We create datasources manually, so a lack of configuration doesn't mean Quarkus should step in with defaults. @@ -10,7 +10,7 @@ quarkus.datasource.devservices.enabled=false # Inventory persistence unit quarkus.hibernate-orm."inventory".database.generation=none quarkus.hibernate-orm."inventory".multitenant=database -quarkus.hibernate-orm."inventory".dialect=org.hibernate.dialect.MariaDB103Dialect +quarkus.hibernate-orm."inventory".dialect=org.hibernate.dialect.MariaDB106Dialect quarkus.hibernate-orm."inventory".packages=io.quarkus.it.hibernate.multitenancy.inventory #mariadb.base_url is set through Maven config diff --git a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/resources/application.properties b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/resources/application.properties index cff2e2163f972..259054f66958b 100644 --- a/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/resources/application.properties +++ b/integration-tests/hibernate-orm-tenancy/connection-resolver/src/main/resources/application.properties @@ -1,7 +1,7 @@ # Hibernate ORM settings quarkus.hibernate-orm.database.generation=none quarkus.hibernate-orm.multitenant=database -quarkus.hibernate-orm.dialect=org.hibernate.dialect.MariaDB103Dialect +quarkus.hibernate-orm.dialect=org.hibernate.dialect.MariaDB106Dialect quarkus.hibernate-orm.packages=io.quarkus.it.hibernate.multitenancy.fruit # We create datasources manually, so a lack of configuration doesn't mean Quarkus should step in with defaults. @@ -10,7 +10,7 @@ quarkus.datasource.devservices.enabled=false # Inventory persistence unit quarkus.hibernate-orm."inventory".database.generation=none quarkus.hibernate-orm."inventory".multitenant=database -quarkus.hibernate-orm."inventory".dialect=org.hibernate.dialect.MariaDB103Dialect +quarkus.hibernate-orm."inventory".dialect=org.hibernate.dialect.MariaDB106Dialect quarkus.hibernate-orm."inventory".packages=io.quarkus.it.hibernate.multitenancy.inventory #mariadb.base_url is set through Maven config diff --git a/integration-tests/jpa-mariadb/src/main/resources/META-INF/persistence.xml b/integration-tests/jpa-mariadb/src/main/resources/META-INF/persistence.xml index a3893c33fedf0..ea5c9b524f47e 100644 --- a/integration-tests/jpa-mariadb/src/main/resources/META-INF/persistence.xml +++ b/integration-tests/jpa-mariadb/src/main/resources/META-INF/persistence.xml @@ -13,7 +13,7 @@ - +