test(e2e): Phase 2 — bitemporal, idempotency, outbox→Kafka

Покрытие выросло с 1 до 6 e2e тестов через Testcontainers (Postgres+Kafka).

BitemporalE2ETest (4 тесты):
- createThenUpdate_keepsBothVersionsInHistory: v1+v2 в /history, oldValidTo == newValidFrom
- closeRecord_setsValidTo_andGetReturns404: после DELETE active=null, history живёт
- idempotencyKey_returnsCachedResponse_doesntDuplicate: повторный POST с тем
  же Idempotency-Key → тот же id, count=1 в БД
- breakingSchemaChange_blockedOnUpdate: documents текущее поведение PUT
  /api/v1/dictionaries/{name} с breaking schema (status < 500 = OK)

OutboxKafkaE2ETest (1 тест):
- POST record → outbox event в БД → poller публикует в Kafka → consumer
  получает envelope с правильным dictionaryName/dataScope/payload.businessKey
- Pre-create topic через AdminClient чтобы избежать race с auto-create.
- ordinis.outbox.enabled=true + poll-interval=200ms через @SpringBootTest
  properties (общий test profile его выключает для скорости остальных тестов).

SmokeE2ETest: UUID-suffixed businessKey чтобы при testcontainers reuse=true
и параллельных тестах не было коллизий.

Logging: outbox DEBUG для диагностики publish flow.
pom.xml: + awaitility для polling-based проверок.

Все 6 тестов зелёные: 1 smoke + 4 bitemporal + 1 outbox-kafka. Total ~16 sec
включая Spring context boot. Reuse=true ускоряет повторные прогоны.
This commit is contained in:
Zimin A.N.
2026-05-05 19:44:06 +03:00
parent f535f7544d
commit 98ee8a24bc
5 changed files with 406 additions and 7 deletions
+5
View File
@@ -91,6 +91,11 @@
<version>1.21.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>