Browse Source

Updating Oracle version to Oracle Free 23.

The new image is configured as compatible with the old image, which it actually isn't.
The default database names are different, so we also set a database name that is different both from the one used by TestContainers as default and the one used by the Docker image.
If the TestContainers default is used the database is not found, because the image just creates the default one and the name doesn't mach.
If the Docker image default is used, the image creates its default database and then tries to create it again, which fails.

These workarounds may be removed once TestContainers properly supports the new image.

Closing #1528
pull/1543/head
Jens Schauder 3 years ago
parent
commit
3cac9d1456
No known key found for this signature in database
GPG Key ID: 9537B67540F0A581
  1. 7
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/OracleDataSourceConfiguration.java
  2. 2
      spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java

7
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/OracleDataSourceConfiguration.java

@ -25,6 +25,7 @@ import org.springframework.jdbc.core.JdbcTemplate; @@ -25,6 +25,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.utility.DockerImageName;
/**
* {@link DataSource} setup for Oracle Database XE. Starts a docker container with an Oracle database.
@ -50,7 +51,11 @@ public class OracleDataSourceConfiguration extends DataSourceConfiguration { @@ -50,7 +51,11 @@ public class OracleDataSourceConfiguration extends DataSourceConfiguration {
if (ORACLE_CONTAINER == null) {
LOG.info("Oracle starting...");
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:21.3.0-slim").withReuse(true);
DockerImageName dockerImageName = DockerImageName.parse("gvenzl/oracle-free:23-slim")
.asCompatibleSubstituteFor("gvenzl/oracle-xe");
OracleContainer container = new OracleContainer(dockerImageName)
.withDatabaseName("freepdb2")
.withReuse(true);
container.start();
LOG.info("Oracle started");

2
spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java

@ -33,7 +33,7 @@ public class ProxyImageNameSubstitutor extends ImageNameSubstitutor { @@ -33,7 +33,7 @@ public class ProxyImageNameSubstitutor extends ImageNameSubstitutor {
private static final Logger LOG = LoggerFactory.getLogger(ProxyImageNameSubstitutor.class);
private static final List<String> NAMES_TO_PROXY_PREFIX = List.of("ryuk", "arm64v8/mariadb", "ibmcom/db2",
"gvenzl/oracle-xe");
"gvenzl/oracle-free");
private static final List<String> NAMES_TO_LIBRARY_PROXY_PREFIX = List.of("mariadb", "mysql", "postgres");

Loading…
Cancel
Save