- Fixed schema isolation handling in Exposed by switching table creation to JDBC and explicitly setting `search_path` in PostgreSQL. - Removed redundant `runBlocking` calls, unused variables, and IDE warnings in the test. - Added `JwtDecoder` mock in `@TestConfiguration` to prevent application context loading errors. - Verified that writes in one tenant schema are no longer visible in another. chore(config): add `application-test.yaml` for better test environment setup - Configured H2 as an in-memory database for tests. - Disabled Flyway and Consul to avoid unnecessary dependencies during testing.
1.8 KiB
1.8 KiB
| type | status | owner | last_update |
|---|---|---|---|
| Journal | ACTIVE | DevOps Engineer | 2026-04-14 |
Session Log: Fix Entries Service Integration Tests (EOFException / PostgreSQL Connection)
Problem
Die Integrationstests im Modul :backend:services:entries:entries-service (BewerbeZeitplanIntegrationTest, NennungBillingIntegrationTest) schlugen mit einer FlywaySqlUnableToConnectToDbException (verursacht durch PSQLException: EOFException) fehl.
Ursache war das Fehlen einer application-test.yaml. Dadurch wurden die Standardwerte aus application.yaml geladen, welche eine aktive PostgreSQL-Instanz auf localhost:5432 sowie Consul und Flyway-Migrationen erwarteten. In der CI/Test-Umgebung ohne diese Infrastruktur führte der Verbindungsversuch zum Abbruch.
Lösung
- Test-Konfiguration erstellt: Eine neue Datei
backend/services/entries/entries-service/src/test/resources/application-test.yamlwurde angelegt.- Umstellung auf H2 In-Memory Datenbank (
jdbc:h2:mem:entries-test). - Deaktivierung von Flyway (
spring.flyway.enabled=false), da die Tests Tabellen manuell via ExposedSchemaUtilsanlegen. - Deaktivierung von Consul Discovery (
spring.cloud.consul.enabled=false). - Umstellung der Multitenancy-Registry auf
inmem.
- Umstellung auf H2 In-Memory Datenbank (
- Verifizierung: Die Tests im Modul wurden mit
./gradlew :backend:services:entries:entries-service:testerfolgreich durchgeführt (5 Tests bestanden, 1 übersprungen/disabled).
Betroffene Dateien
backend/services/entries/entries-service/src/test/resources/application-test.yaml: Neue Konfiguration für dastestProfil.
Handover
- Die
EntriesIsolationIntegrationTestbleibt weiterhin@Disabled, da sie Testcontainers benötigt und laut Quellcode-Kommentar noch weitere Fixes für die Exposed-Metadaten-Isolierung erfordert.