meldestelle/docs/99_Journal/2026-04-14_DevOps_Entries-Service-Test-Fix.md
Stefan Mogeritsch f961b6e771 chore(docs+tests): reactivate EntriesIsolationIntegrationTest and resolve tenant data isolation issues
- 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.
2026-04-14 12:25:27 +02:00

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

  1. Test-Konfiguration erstellt: Eine neue Datei backend/services/entries/entries-service/src/test/resources/application-test.yaml wurde 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 Exposed SchemaUtils anlegen.
    • Deaktivierung von Consul Discovery (spring.cloud.consul.enabled=false).
    • Umstellung der Multitenancy-Registry auf inmem.
  2. Verifizierung: Die Tests im Modul wurden mit ./gradlew :backend:services:entries:entries-service:test erfolgreich 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 das test Profil.

Handover

  • Die EntriesIsolationIntegrationTest bleibt weiterhin @Disabled, da sie Testcontainers benötigt und laut Quellcode-Kommentar noch weitere Fixes für die Exposed-Metadaten-Isolierung erfordert.