test(e2e): smoke test через Testcontainers + fix audit_log.ip_address INET bug
Phase 1 e2e — proof framework работает: - E2ESupport: Postgres 18 (postgis/postgis:18-3.6) + Kafka (cp-kafka 7.6.0) через Testcontainers, reuse=true. db-init.sql создаёт postgis+btree_gist расширения которые ожидает Liquibase 0001. - application-test.yml: тушит cloud-config/vault/otel/outbox publishing, включает Liquibase autoconfig. Auth disabled для упрощения. - SmokeE2ETest: full e2e — POST dictionary → POST record → GET record → проверка audit_log row. UUID-suffix в dictName для идемпотентности. - master.xml: relativeToChangelogFile=true для всех include — иначе Liquibase из ordinis-app classpath не находит changes/X.xml в JAR. - pom.xml: testcontainers 1.21.3, surefire env DOCKER_HOST + DOCKER_API_VERSION для macOS Docker Desktop. Найден реальный prod-баг: audit_log.ip_address был INET, Hibernate JPA не делает автоматический cast String→INET → INSERT падал. AuditLogger.write обёрнут в try/catch, поэтому тихо съедал ошибку — на staging audit_log оставался пустым после CRUD. - 0012-audit-log-ipaddress-varchar.xml: ALTER COLUMN INET → VARCHAR(64) - AuditLog entity: убрал columnDefinition="inet", length=64.
This commit is contained in:
@@ -54,12 +54,48 @@
|
||||
<artifactId>spring-cloud-starter-vault-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Migrations module — нужен на classpath для миграций при тесте,
|
||||
в проде Liquibase запускается отдельным Job в k8s. -->
|
||||
<dependency>
|
||||
<groupId>cloud.nstart.terravault.ordinis</groupId>
|
||||
<artifactId>ordinis-migrations</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>1.21.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>1.21.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>kafka</artifactId>
|
||||
<version>1.21.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -68,6 +104,23 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Testcontainers требует DOCKER_HOST. На macOS Docker Desktop
|
||||
socket в ~/.docker/run, не /var/run. ENV не наследуется в
|
||||
forked surefire процесс по умолчанию — пробрасываем явно. -->
|
||||
<environmentVariables>
|
||||
<DOCKER_HOST>${env.DOCKER_HOST}</DOCKER_HOST>
|
||||
<DOCKER_API_VERSION>1.45</DOCKER_API_VERSION>
|
||||
<TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
|
||||
</environmentVariables>
|
||||
<systemPropertyVariables>
|
||||
<api.version>1.45</api.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user