Skip to content

Commit

Permalink
Updated tests to use oracle-free for native ARM support
Browse files Browse the repository at this point in the history
Signed-off-by: Jamie Briggs <[email protected]>
  • Loading branch information
JamieBriggs-MoJ committed Jan 17, 2025
1 parent 995c5b3 commit 40949d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
implementation platform('org.testcontainers:testcontainers-bom:1.20.4')
testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:oracle-xe'
testImplementation 'org.testcontainers:oracle-free'
testImplementation 'org.hibernate:hibernate-core:6.6.3.Final'
testImplementation 'com.h2database:h2:2.3.232'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.oracle.OracleContainer;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@Testcontainers
Expand All @@ -16,9 +17,11 @@ public interface IntegrationTestInterface {

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
registry.add("spring.datasource.url", oracleContainerSingleton.getOracleContainer()::getJdbcUrl);
registry.add("spring.datasource.username", oracleContainerSingleton.getOracleContainer()::getUsername);
registry.add("spring.datasource.password", oracleContainerSingleton.getOracleContainer()::getPassword);
OracleContainer oracleContainer = oracleContainerSingleton.getOracleContainer();
// Use service name
registry.add("spring.datasource.url", oracleContainer::getJdbcUrl);
registry.add("spring.datasource.username", oracleContainer::getUsername);
registry.add("spring.datasource.password", oracleContainer::getPassword);
}
}

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package uk.gov.laa.ccms.data;

import org.testcontainers.containers.OracleContainer;
import org.testcontainers.oracle.OracleContainer;

public class OracleContainerSingleton {

private static OracleContainerSingleton instance;
private final OracleContainer oracleContainer;

private OracleContainerSingleton() {
oracleContainer = new OracleContainer("gvenzl/oracle-xe:21-slim-faststart");
oracleContainer = new OracleContainer("gvenzl/oracle-free:23-slim-faststart");
oracleContainer.start();
}

Expand Down

0 comments on commit 40949d9

Please sign in to comment.