Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- **Flaky backend tests** — Resolved intermittent `PSQLException: Connection refused` errors in CI by fixing Testcontainers lifecycle mismatch (`@Container` moved to `companion object` for all `@TestInstance(PER_CLASS)` test classes) and disabling parallel test-class execution (`maxParallelForks = 1`) to prevent Exposed's global database registry from being overwritten mid-test by a concurrently running test class

## [6.3.0] - 2026-03-30

### Added
Expand Down
1 change: 1 addition & 0 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach

tasks.test {
useJUnitPlatform()
maxParallelForks = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ItemRepositoryTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private lateinit var listRepository: ListRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ListRepositoryTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private lateinit var listRepository: ListRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class PushSubscriptionRepositoryTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private lateinit var listRepository: ListRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TransactionTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private lateinit var listRepository: ListRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ListRoutesTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private val json = Json { ignoreUnknownKeys = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ import kotlin.test.assertNull
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class CleanupServiceTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_cleanup")
.withUsername("test_user")
.withPassword("test_pass")

companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_cleanup")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private lateinit var cleanupService: CleanupService
private lateinit var listRepository: ListRepositoryImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ import kotlin.test.assertTrue
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class WebSocketIntegrationTest {

@Container
private val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
companion object {
@Container
@JvmField
val postgres = PostgreSQLContainer("postgres:15-alpine")
.withDatabaseName("test_shopping_lists")
.withUsername("test_user")
.withPassword("test_pass")
}

private lateinit var database: Database
private val json = Json { ignoreUnknownKeys = true }
Expand Down
Loading