Skip to content

Commit

Permalink
Merge pull request #23329 from famod/mariadb-10.6
Browse files Browse the repository at this point in the history
Update MariaDB image to 10.6 for integration tests and dev services
  • Loading branch information
gsmet authored Feb 1, 2022
2 parents 29e7dd0 + 72386e3 commit a63da1f
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<!-- Database images for JDBC/Reactive/Hibernate tests -->
<postgres.image>docker.io/postgres:14.1</postgres.image>
<mariadb.image>docker.io/mariadb:10.4</mariadb.image>
<mariadb.image>docker.io/mariadb:10.6</mariadb.image>
<db2.image>docker.io/ibmcom/db2:11.5.5.0</db2.image>
<mssql.image>mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04</mssql.image>
<oracle.image>docker.io/gvenzl/oracle-xe:21.3.0-slim</oracle.image>
Expand Down
9 changes: 9 additions & 0 deletions extensions/devservices/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@
<artifactId>quarkus-core</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mariadb.image=${mariadb.image}
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -75,8 +74,8 @@ private static class QuarkusMariaDBContainer extends MariaDBContainer {

public QuarkusMariaDBContainer(Optional<String> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<property name="hibernate.archive.autodetection" value="class, hbm"/>

<!-- Connection specific -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MariaDB103Dialect"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MariaDB106Dialect"/>

<!-- Tuning and debugging -->
<property name="hibernate.show_sql" value="false"/>
Expand Down

0 comments on commit a63da1f

Please sign in to comment.