fix(tests): resolve EntriesIsolationIntegrationTest failures with test-specific DB config
- Added `TestExposedConfiguration` to connect Exposed with Spring `DataSource` in the `test` profile.
- Downgraded `springdoc` version from `3.0.0` to `2.8.9` for Spring Boot 3.x compatibility.
- Applied `@ActiveProfiles("test")` to `EntriesIsolationIntegrationTest`.
- Updated roadmap documentation to reflect bugfix and test success.
Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
parent
2270f9602f
commit
f4844eb428
|
|
@ -0,0 +1,21 @@
|
|||
package at.mocode.entries.service.config
|
||||
|
||||
import org.jetbrains.exposed.v1.jdbc.Database
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Profile
|
||||
import javax.sql.DataSource
|
||||
|
||||
/**
|
||||
* Verbindet Exposed mit der Spring-DataSource im Test-Profil.
|
||||
* Ersetzt die EntriesDatabaseConfiguration (die mit @Profile("!test") ausgeschlossen ist).
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("test")
|
||||
class TestExposedConfiguration {
|
||||
|
||||
@Bean
|
||||
fun exposedDatabase(dataSource: DataSource): Database {
|
||||
return Database.connect(dataSource)
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ import org.junit.jupiter.api.extension.ExtendWith
|
|||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
import org.springframework.jdbc.core.JdbcTemplate
|
||||
import org.springframework.test.context.ActiveProfiles
|
||||
import org.springframework.test.context.DynamicPropertyRegistry
|
||||
import org.springframework.test.context.DynamicPropertySource
|
||||
import org.springframework.test.context.TestPropertySource
|
||||
|
|
@ -52,6 +53,7 @@ import kotlin.uuid.Uuid
|
|||
// Als Fallback: Bean-Override in Testkontext erlauben (sollte i.d.R. nicht nötig sein)
|
||||
"spring.main.allow-bean-definition-overriding=true"
|
||||
])
|
||||
@ActiveProfiles("test")
|
||||
@Testcontainers
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
class EntriesIsolationIntegrationTest @Autowired constructor(
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
- [x] **Rollout auf weitere Services** — masterdata/events/zns-import nutzen kein eigenes Tenant-Schema (
|
||||
Single-Tenant-Architektur per ADR-0021 korrekt; nur Entries-Service ist Multi-Tenant)
|
||||
- [x] E2E-Isolationstest re-enabled (`@Disabled` entfernt; `EntriesIsolationIntegrationTest` aktiv)
|
||||
- [x] E2E-Test-Bugfix: `springdoc` von `3.0.0` → `2.8.9` (ClassNotFoundException behoben); `@ActiveProfiles("test")` +
|
||||
`TestExposedConfiguration` ergänzt (Exposed DB-Connect im Test-Profil); alle Tests grün ✅
|
||||
|
||||
- [ ] **A-3** | Validierungs-Grundlage: Turnierkategorie-Limits
|
||||
- [x] Entkoppelte Policy-Schnittstelle + Bewerb-Descriptor implementiert
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
# 🧹 Session Log — 2026-04-03
|
||||
|
||||
## Agent: 👷 Backend Developer
|
||||
|
||||
## Aufgabe
|
||||
|
||||
`EntriesIsolationIntegrationTest` schlägt fehl mit `ClassNotFoundException` und `No database specified`.
|
||||
|
||||
## Root Cause Analyse
|
||||
|
||||
### Problem 1: `ClassNotFoundException` (Spring Context Load)
|
||||
|
||||
- `springdoc-openapi` war auf Version `3.0.0` gesetzt
|
||||
- Diese Version ist für Spring Boot 4.x / Spring 7 gedacht und zieht Spring Boot 4.x-Klassen transitiv rein
|
||||
- Im Spring Boot 3.x-Kontext führt das zu `ClassNotFoundException` für `JacksonJsonHttpMessageConverter`
|
||||
|
||||
### Problem 2: `No database specified` (Exposed)
|
||||
|
||||
- `EntriesDatabaseConfiguration` ist mit `@Profile("!test")` annotiert → wird im Test nicht geladen
|
||||
- Exposed braucht `Database.connect()` vor dem ersten `transaction {}`-Aufruf
|
||||
- Im Test-Profil gab es keine Konfiguration, die Exposed mit der Spring `DataSource` (Testcontainer) verbindet
|
||||
- `@ActiveProfiles("test")` fehlte am Test → `TestExposedConfiguration` wurde nicht geladen
|
||||
|
||||
## Änderungen
|
||||
|
||||
| Datei | Änderung |
|
||||
|------------------------------------------------------------|----------------------------------------------------------------------------|
|
||||
| `gradle/libs.versions.toml` | `springdoc` von `3.0.0` → `2.8.9` (Spring Boot 3.x kompatibel) |
|
||||
| `entries-service/src/test/.../TestExposedConfiguration.kt` | Neu: `@Profile("test")` Bean der Exposed mit Spring `DataSource` verbindet |
|
||||
| `EntriesIsolationIntegrationTest.kt` | `@ActiveProfiles("test")` hinzugefügt; Import sortiert |
|
||||
| `Backend_Roadmap.md` | Bugfix dokumentiert unter A-1 |
|
||||
|
||||
## Ergebnis
|
||||
|
||||
- Alle Tests im `entries-service` grün ✅ (`BUILD SUCCESSFUL`)
|
||||
- `EntriesIsolationIntegrationTest` läuft vollständig durch
|
||||
|
|
@ -47,7 +47,7 @@ springBoot = "3.5.9"
|
|||
# Downgraded from 2025.1.0 (Oakwood) to 2025.0.1 (Northfields) for Spring Boot 3.5.x compatibility
|
||||
springCloud = "2025.0.1"
|
||||
springDependencyManagement = "1.1.7"
|
||||
springdoc = "3.0.0"
|
||||
springdoc = "2.8.9"
|
||||
|
||||
# Server Persistence
|
||||
# Final release 1.0.0 (UUID API refinements vs. rc-4)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user