Skip to content

Commit cc2b25b

Browse files
committed
fix(all-tests): change the configuration and add information in .env
1 parent af1a832 commit cc2b25b

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

.env.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ LB_CHANGELOG=your_changelog_file.yaml
88
LB_OUTPUT_CHANGELOG=your_output_changelog.yaml
99
LB_DRIVER=your_jdbc_driver_class
1010
LB_SCHEMA=your_database_schema
11+
12+
#H2 configuration
13+
H2_URL=your_h2_url
14+
H2_USERNAME=your_h2_username
15+
H2_PASSWORD=your_h2_password

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: '3.8'
2-
31
services:
42
postgres:
5-
image: postgres:17.9-alpine
3+
image: postgres:17-alpine
64
container_name: xpeho_postgres
75
environment:
86
POSTGRES_USER: ${POSTGRES_USER}

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</scm>
2929
<properties>
3030
<java.version>25</java.version>
31-
<testcontainers.version>1.19.8</testcontainers.version>
31+
<testcontainers.version>2.0.4</testcontainers.version>
3232
<skipDocker>false</skipDocker>
3333
<sonar.coverage.exclusions>**/*Application.java</sonar.coverage.exclusions>
3434
<sonar.test.exclusions>**/feature/SpringIntegrationTest.java</sonar.test.exclusions>
@@ -137,12 +137,12 @@
137137
</dependency>
138138
<dependency>
139139
<groupId>org.testcontainers</groupId>
140-
<artifactId>junit-jupiter</artifactId>
140+
<artifactId>testcontainers-junit-jupiter</artifactId>
141141
<scope>test</scope>
142142
</dependency>
143143
<dependency>
144144
<groupId>org.testcontainers</groupId>
145-
<artifactId>postgresql</artifactId>
145+
<artifactId>testcontainers-postgresql</artifactId>
146146
<scope>test</scope>
147147
</dependency>
148148
<dependency>

src/test/java/com/xpeho/spring_boot_java_random_user/presentation/UserGetByIdContainerTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
import org.springframework.boot.resttestclient.TestRestTemplate;
1414
import org.springframework.http.HttpStatus;
1515
import org.springframework.http.ResponseEntity;
16-
import org.springframework.test.context.ActiveProfiles;
17-
import org.testcontainers.containers.PostgreSQLContainer;
16+
17+
import org.testcontainers.postgresql.PostgreSQLContainer;
1818
import org.testcontainers.junit.jupiter.Container;
1919
import org.testcontainers.junit.jupiter.Testcontainers;
2020

2121
import static org.assertj.core.api.Assertions.assertThat;
2222

2323
@Testcontainers
2424
@AutoConfigureTestRestTemplate
25-
@ActiveProfiles("test")
2625
@SpringBootTest(
2726
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
2827
properties = {
@@ -34,7 +33,7 @@ class UserGetByIdContainerTest {
3433

3534
@Container
3635
@ServiceConnection
37-
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16-alpine");
36+
static PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:17-alpine");
3837

3938
@Autowired
4039
private TestRestTemplate restTemplate;

0 commit comments

Comments
 (0)