diff --git a/relay-store-service/build.gradle b/relay-store-service/build.gradle index 62007560..9043c2cd 100644 --- a/relay-store-service/build.gradle +++ b/relay-store-service/build.gradle @@ -1,6 +1,6 @@ plugins { id 'com.google.cloud.tools.jib' version '3.3.1' - id 'org.springframework.boot' version '3.0.6' + id 'org.springframework.boot' version '3.1.0' id 'io.spring.dependency-management' version '1.1.0' id 'java' id "org.sonarqube" version "4.0.0.2929" @@ -86,6 +86,8 @@ dependencies { // annotationProcessor "io.dekorate:kubernetes-spring-starter:${dekorateVersion}" testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' + testImplementation 'org.springframework.boot:spring-boot-testcontainers' + testImplementation 'org.springframework.boot:spring-boot-devtools' testImplementation 'org.testcontainers:junit-jupiter' testImplementation 'org.testcontainers:postgresql' diff --git a/relay-store-service/src/test/java/com/relay/AppWithTestContainers.java b/relay-store-service/src/test/java/com/relay/AppWithTestContainers.java new file mode 100644 index 00000000..f6363201 --- /dev/null +++ b/relay-store-service/src/test/java/com/relay/AppWithTestContainers.java @@ -0,0 +1,10 @@ +package com.relay; + +import org.springframework.boot.SpringApplication; + +public class AppWithTestContainers { + + public static void main(String[] args) { + SpringApplication.from(RelaySystemApplication::main).with(TestContainersConfiguration.class).run(args); + } +} diff --git a/relay-store-service/src/test/java/com/relay/TestContainersConfiguration.java b/relay-store-service/src/test/java/com/relay/TestContainersConfiguration.java new file mode 100644 index 00000000..03178e74 --- /dev/null +++ b/relay-store-service/src/test/java/com/relay/TestContainersConfiguration.java @@ -0,0 +1,17 @@ +package com.relay; + +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.testcontainers.containers.PostgreSQLContainer; + +@TestConfiguration(proxyBeanMethods = false) +public class TestContainersConfiguration { + + @Bean + @ServiceConnection + public PostgreSQLContainer postgresqlContainer() { + return new PostgreSQLContainer(); + } + +}