diff --git a/scheduler/boot-scheduler-shedlock/docker/docker-compose.yml b/scheduler/boot-scheduler-shedlock/docker/docker-compose.yml index c585170da..3a59f6f48 100644 --- a/scheduler/boot-scheduler-shedlock/docker/docker-compose.yml +++ b/scheduler/boot-scheduler-shedlock/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: postgresqldb: - image: postgres:16.6-alpine + image: postgres:17.2-alpine environment: - POSTGRES_USER=appuser - POSTGRES_PASSWORD=secret diff --git a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/SchemaValidationTest.java b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/SchemaValidationTest.java index 37acc06ac..9a650c64d 100644 --- a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/SchemaValidationTest.java +++ b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/SchemaValidationTest.java @@ -1,14 +1,26 @@ package com.learning.shedlock; +import static org.assertj.core.api.Assertions.assertThat; + import com.learning.shedlock.common.ContainersConfig; +import com.zaxxer.hikari.HikariDataSource; +import javax.sql.DataSource; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.context.annotation.Import; -@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate", "spring.test.database.replace=none"}) +@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate"}) @Import(ContainersConfig.class) +@AutoConfigureTestDatabase class SchemaValidationTest { + @Autowired + private DataSource dataSource; + @Test - void validateJpaMappingsWithDbSchema() {} + void validateJpaMappingsWithDbSchema() { + assertThat(dataSource).isInstanceOf(HikariDataSource.class); + } } diff --git a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/TestShedLockApplication.java b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/TestShedLockApplication.java index bfa76ce70..16c68c15d 100644 --- a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/TestShedLockApplication.java +++ b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/TestShedLockApplication.java @@ -6,9 +6,9 @@ public class TestShedLockApplication { public static void main(String[] args) { - System.setProperty("spring.profiles.active", "local"); SpringApplication.from(ShedLockApplication::main) .with(ContainersConfig.class) + .withAdditionalProfiles("local") .run(args); } } diff --git a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/common/ContainersConfig.java b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/common/ContainersConfig.java index af0721e9c..9505f97b5 100644 --- a/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/common/ContainersConfig.java +++ b/scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/common/ContainersConfig.java @@ -12,6 +12,6 @@ public class ContainersConfig { @Bean @ServiceConnection PostgreSQLContainer postgreSQLContainer() { - return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.4-alpine")); + return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("17.2-alpine")); } }