Skip to content

Commit

Permalink
feat : fix running the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Dec 4, 2023
1 parent ddd4a44 commit 47f795d
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.lifecycle.Startables;
import org.testcontainers.oracle.OracleContainer;
import org.testcontainers.utility.DockerImageName;

@Testcontainers(disabledWithoutDocker = true, parallel = true)
public class DBContainerInitializer {

@Container
private static final PostgreSQLContainer<?> POSTGRE_SQL_CONTAINER =
new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.1-alpine"));
new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.1-alpine"))
.withReuse(true);

@Container
private static final OracleContainer ORACLE_CONTAINER =
new OracleContainer(
DockerImageName.parse("gvenzl/oracle-free")
.withTag("23-slim-faststart"))
.withReuse(true);

static {
Startables.deepStart(POSTGRE_SQL_CONTAINER, ORACLE_CONTAINER).join();
}

@DynamicPropertySource
static void addsDynamicProperties(DynamicPropertyRegistry propertyRegistry) {
propertyRegistry.add("datasource.primary.url", ORACLE_CONTAINER::getJdbcUrl);
Expand Down

0 comments on commit 47f795d

Please sign in to comment.