Skip to content

Commit

Permalink
Updating Oracle version to Oracle Free 23.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
schauder committed Jun 14, 2023
1 parent 121317f commit 3cac9d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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.
Expand All @@ -50,7 +51,11 @@ protected DataSource createDataSource() {
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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 3cac9d1

Please sign in to comment.