Fix postgres 18 TestDatabases by pinning the data dir

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2025-12-03 10:11:54 +01:00
parent 60aadc06b2
commit 5a737e1cab
5 changed files with 46 additions and 33 deletions
+1 -1
View File
@@ -75,7 +75,7 @@
"mysql2": "^3.0.0",
"pg": "^8.11.3",
"pg-connection-string": "^2.3.0",
"testcontainers": "^10.0.0",
"testcontainers": "^11.9.0",
"text-extensions": "^2.4.0",
"uuid": "^11.0.0",
"yn": "^4.0.0",
@@ -77,7 +77,11 @@ export async function startPostgresContainer(image: string): Promise<{
const container = await new GenericContainer(image)
.withExposedPorts(5432)
.withEnvironment({ POSTGRES_PASSWORD: password })
.withEnvironment({
// Since postgres 18, the default directory changed - so we pin it here
PGDATA: '/var/lib/postgresql/data',
POSTGRES_PASSWORD: password,
})
.withTmpFs({ '/var/lib/postgresql/data': 'rw' })
.start();