Skip to content

Commit

Permalink
[Misc] Ensure to be able to use Oracle image for docker test
Browse files Browse the repository at this point in the history
  * Set the missing instructions for allowing to use our custom image
  * Fix the username since TC does not allow to use sys/system user
  • Loading branch information
surli committed Mar 30, 2022
1 parent e675063 commit e677893
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.testcontainers.containers.Network;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;
import org.xwiki.test.docker.internal.junit5.AbstractContainerExecutor;
import org.xwiki.test.docker.junit5.TestConfiguration;
import org.xwiki.test.junit5.RuntimeUtils;
Expand Down Expand Up @@ -248,14 +249,17 @@ private void mountDatabaseDataIfNeeded(JdbcDatabaseContainer<?> databaseContaine
private void startOracleContainer(TestConfiguration testConfiguration) throws Exception
{
JdbcDatabaseContainer<?> databaseContainer;
String oracleImageFullName;
if (testConfiguration.getDatabaseTag() != null) {
databaseContainer = new OracleContainer(String.format("xwiki/oracle-database:%s",
testConfiguration.getDatabaseTag()));
oracleImageFullName = String.format("xwiki/oracle-database:%s", testConfiguration.getDatabaseTag());
} else {
databaseContainer = new OracleContainer("xwiki/oracle-database");
oracleImageFullName = "xwiki/oracle-database";
}
DockerImageName oracleImage = DockerImageName.parse(oracleImageFullName)
.asCompatibleSubstituteFor("gvenzl/oracle-xe");
databaseContainer = new OracleContainer(oracleImage);
databaseContainer
.withUsername("system")
.withUsername("oracle")
.withPassword("oracle");

startDatabaseContainer(databaseContainer, 1521, testConfiguration);
Expand Down

0 comments on commit e677893

Please sign in to comment.