Skip to content

Commit

Permalink
Standardise mongo image version
Browse files Browse the repository at this point in the history
  • Loading branch information
rashidi authored Nov 24, 2024
1 parent e8916ea commit a630c42
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
10 changes: 5 additions & 5 deletions data-mongodb-tc-data-load/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UserRepositoryTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"));
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest");
@Autowired
private UserRepository repository;
Expand Down Expand Up @@ -133,7 +133,7 @@ class UserRepositoryTests {
@Bean
MongoDBContainer mongoDbContainer(DynamicPropertyRegistry registry) {
var mongo = new MongoDBContainer("mongo:6");
var mongo = new MongoDBContainer("mongo:latest");
registry.add("spring.data.mongodb.uri", mongo::getReplicaSetUrl);
Expand Down Expand Up @@ -170,7 +170,7 @@ class UserRepositoryTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"))
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest")
.withCopyToContainer(forClasspathResource("mongo-init.js"), "/docker-entrypoint-initdb.d/mongo-init.js");
}
----
Expand All @@ -186,7 +186,7 @@ class UserRepositoryTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"))
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest")
.withCopyToContainer(forClasspathResource("mongo-init.js"), "/docker-entrypoint-initdb.d/mongo-init.js")
.waitingFor(forLogMessage("(?i).*waiting for connections.*", 1));
}
Expand All @@ -202,7 +202,7 @@ class UserRepositoryTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"))
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest")
.withCopyToContainer(forClasspathResource("mongo-init.js"), "/docker-entrypoint-initdb.d/mongo-init.js")
.waitingFor(forLogMessage("(?i).*waiting for connections.*", 1))
.withStartupAttempts(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.testcontainers.containers.MongoDBContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import static java.time.Duration.ofMinutes;
import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -24,7 +23,7 @@ class UserRepositoryTests {

@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"))
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest")
.withCopyToContainer(forClasspathResource("mongo-init.js"), "/docker-entrypoint-initdb.d/mongo-init.js")
.waitingFor(forLogMessage("(?i).*waiting for connections.*", 1))
.withStartupAttempts(2)
Expand Down
2 changes: 1 addition & 1 deletion data-mongodb-transactional/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CreateUserTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"));
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest");
@Autowired
private TestRestTemplate restTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package zin.rashidi.boot.data.mongodb.tm.user;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static zin.rashidi.boot.data.mongodb.tm.user.User.Status.ACTIVE;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -16,7 +10,12 @@
import org.testcontainers.containers.MongoDBContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static zin.rashidi.boot.data.mongodb.tm.user.User.Status.ACTIVE;

/**
* @author Rashidi Zin
Expand All @@ -27,7 +26,7 @@ class CreateUserTests {

@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"));
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest");

@Autowired
private TestRestTemplate restTemplate;
Expand Down
2 changes: 1 addition & 1 deletion test-execution-listeners/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class UserRepositoryTests {
@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"));
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest");
@Autowired
private UserRepository repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserRepositoryTests {

@Container
@ServiceConnection
private static final MongoDBContainer mongo = new MongoDBContainer(DockerImageName.parse("mongo").withTag("6"));
private static final MongoDBContainer mongo = new MongoDBContainer("mongo:latest");

@Autowired
private UserRepository repository;
Expand Down

0 comments on commit a630c42

Please sign in to comment.