Spring Boot 3.5.16, testy backendu na PostgreSQL (Testcontainers)
Deploy Polska Lokalnie / deploy (push) Successful in 29s
Deploy Polska Lokalnie / deploy (push) Successful in 29s
- Spring Boot 3.3.5 -> 3.5.16 (linia 3.3 bez poprawek bezpieczenstwa). - Testy zamiast H2 uzywaja tymczasowego PostgreSQL 16 (Testcontainers), tej samej wersji co produkcja; ddl-auto update jak na produkcji. Testcontainers 1.21 (z Boot 3.5) jest wymagany - 1.19 z Boot 3.3 nie dziala z obecnym Docker Desktop, dlatego obie zmiany w jednym commicie. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.3.5</version>
|
<version>3.5.16</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -64,9 +64,10 @@
|
|||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Testy na prawdziwym PostgreSQL (tymczasowy kontener), tak jak produkcja - bez emulacji H2. -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>org.testcontainers</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:h2:mem:polskalokalnie;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE
|
# Testcontainers: przy pierwszym polaczeniu startuje tymczasowy PostgreSQL 16 (ta sama wersja co
|
||||||
username: sa
|
# produkcja w docker-compose), wspolny dla wszystkich testow i usuwany po ich zakonczeniu.
|
||||||
password:
|
# Wymaga uruchomionego Dockera przy "mvn test".
|
||||||
driver-class-name: org.h2.Driver
|
url: jdbc:tc:postgresql:16-alpine:///polskalokalnie
|
||||||
|
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
|
||||||
jpa:
|
jpa:
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: create-drop
|
# Jak na produkcji. create-drop przy kazdym nowym kontekscie Springa kasowal tabele, z ktorych
|
||||||
|
# korzystal juz dzialajacy kontekst; baza i tak jest swieza przy kazdym uruchomieniu testow.
|
||||||
|
ddl-auto: update
|
||||||
|
|
||||||
app:
|
app:
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
Reference in New Issue
Block a user