Skip to content

Commit

Permalink
fix : version in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli authored and renovate[bot] committed Aug 31, 2024
1 parent a8a88e9 commit 07697fc
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TestApplication {
@ServiceConnection
LocalStackContainer localstackContainer() {
return new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.5.0"));
DockerImageName.parse("localstack/localstack").withTag("3.7.1"));
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TestApplication {
LocalStackContainer localstackContainer() {
LocalStackContainer localstackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.6.0"))
DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withCopyFileToContainer(
MountableFile.forHostPath(".localstack/"),
"/etc/localstack/init/ready.d/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
@Import(LocalStackConfig.class)
Expand All @@ -15,7 +16,7 @@ public class TestKinesisConsumerApplication {
@Bean
@ServiceConnection
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>("postgres:16.4-alpine");
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.4-alpine"));
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class LocalStackConfig {

static LocalStackContainer localStackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.5.0"));
DockerImageName.parse("localstack/localstack").withTag("3.7.1"));

static {
localStackContainer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TestKinesisProducerApplication {
LocalStackContainer localStackContainer(DynamicPropertyRegistry dynamicPropertyRegistry) {
LocalStackContainer localStackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.6.0"));
DockerImageName.parse("localstack/localstack").withTag("3.7.1"));
dynamicPropertyRegistry.add("spring.cloud.aws.endpoint", localStackContainer::getEndpoint);
dynamicPropertyRegistry.add(
"spring.cloud.aws.region.static", localStackContainer::getRegion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ class ApplicationIntegrationTest {
static Network network = Network.newNetwork();

@Container
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.2-alpine")
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.4-alpine")
.withNetwork(network)
.withNetworkAliases("postgres")
.withReuse(true);

@Container
static LocalStackContainer localstack = new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.3.0"))
DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withNetwork(network)
.withEnv("LOCALSTACK_HOST", "localhost.localstack.cloud")
.withEnv("LAMBDA_DOCKER_NETWORK", ((Network.NetworkImpl) network).getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class ContainersConfig {
@Bean
@ServiceConnection
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.3-alpine"));
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.4-alpine"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
public class TestApplication {

@Bean
@ServiceConnection
PostgreSQLContainer<?> sqlContainer() {
return new PostgreSQLContainer<>("postgres:16.3-alpine");
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.4-alpine"));
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class LocalStackContainerConfig {

@Container
private static final LocalStackContainer localStackContainer =
new LocalStackContainer(DockerImageName.parse("localstack/localstack").withTag("3.6.0"))
new LocalStackContainer(DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withCopyFileToContainer(
MountableFile.forHostPath("localstack/"),
"/etc/localstack/init/ready.d/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class TestS3Application {
@ServiceConnection
@RestartScope
PostgreSQLContainer<?> postgresContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.2-alpine"))
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.4-alpine"))
.withReuse(true);
}

@Bean
LocalStackContainer localstackContainer(DynamicPropertyRegistry registry) {
LocalStackContainer localStackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.6.0"))
DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withCopyFileToContainer(
MountableFile.forHostPath(".localstack/"),
"/etc/localstack/init/ready.d/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class TestApplication {
@ServiceConnection
LocalStackContainer localStackContainer() {
return new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.6.0"))
DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withCopyFileToContainer(
MountableFile.forHostPath("localstack/"), "/etc/localstack/init/ready.d/")
.waitingFor(Wait.forLogMessage(".*LocalStack initialized successfully\n", 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

public interface DBTestContainer {

@Container @ServiceConnection
PostgreSQLContainer<?> sqlContainer = new PostgreSQLContainer<>("postgres:16.2-alpine");
PostgreSQLContainer<?> sqlContainer =
new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.4-alpine"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class LocalStackContainerConfig {

@Container
private static final LocalStackContainer localStackContainer =
new LocalStackContainer(DockerImageName.parse("localstack/localstack").withTag("3.3.0"))
new LocalStackContainer(DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withCopyFileToContainer(
MountableFile.forHostPath("localstack/"),
"/etc/localstack/init/ready.d/")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
package com.example.awsspring;

import lombok.extern.slf4j.Slf4j;
import com.example.awsspring.common.LocalStackTestContainer;
import org.springframework.boot.SpringApplication;
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.localstack.LocalStackContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;

@Slf4j
@TestConfiguration(proxyBeanMethods = false)
public class TestSESApplication {

@Bean
@ServiceConnection
LocalStackContainer localStackContainer() {
LocalStackContainer localStackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.6.0"));
localStackContainer.start();
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log);
localStackContainer.followOutput(logConsumer);
return localStackContainer;
}

public static void main(String[] args) {
SpringApplication.from(SESApplication::main).with(TestSESApplication.class).run(args);
SpringApplication.from(SESApplication::main).with(LocalStackTestContainer.class).run(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static com.example.awsspring.utils.AppConstants.PROFILE_TEST;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

import com.example.awsspring.TestSESApplication;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
Expand All @@ -12,7 +11,7 @@
import org.springframework.test.web.servlet.MockMvc;

@ActiveProfiles({PROFILE_TEST})
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = TestSESApplication.class)
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = LocalStackTestContainer.class)
@AutoConfigureMockMvc
public abstract class AbstractIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.awsspring.common;

import lombok.extern.slf4j.Slf4j;
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.localstack.LocalStackContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;

@Slf4j
@TestConfiguration(proxyBeanMethods = false)
public class LocalStackTestContainer {

@Bean
@ServiceConnection
LocalStackContainer localStackContainer() {
LocalStackContainer localStackContainer =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.7.1"));
localStackContainer.start();
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log);
localStackContainer.followOutput(logConsumer);
return localStackContainer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class ContainersConfig {
@ServiceConnection
LocalStackContainer localstackContainer() {
return new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.7.0"));
DockerImageName.parse("localstack/localstack").withTag("3.7.1"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class LocalStackTestContainers {
@ServiceConnection
LocalStackContainer localstackContainer() {
return new LocalStackContainer(
DockerImageName.parse("localstack/localstack").withTag("3.7.0"))
DockerImageName.parse("localstack/localstack").withTag("3.7.1"))
.withReuse(true);
}
}

0 comments on commit 07697fc

Please sign in to comment.