Skip to content
Discussion options

You must be logged in to vote

There's nothing in Testcontainers at that layer, so I wasn't missing an API. withReuse is about reusing across JVM runs, not resetting.

The template route works:

CREATE DATABASE test_cls_42 TEMPLATE app_pristine;

Two things that bit me: Postgres refuses to copy a template with any open connection, so the pool must never touch app_pristine, and the previous test database needs pg_terminate_backend before it can be dropped.

What actually mattered more was taking the disk out of the equation. With PGDATA on tmpfs and durability off, the TRUNCATE I was complaining about got cheap enough that the template trick stopped being worth the complexity:

.withTmpFs(Map.of("/var/lib/postgresql/data", "rw"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by codicebot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants