jooq: jOOQ 3.21.9 on Spring Boot 4.2.0 - codegen from Flyway migrations, typed queries, MULTISET, transactions, Testcontainers, fourteen real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7h4ZNF4BDUpJk3Zou
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
8d8c28e2e5
commit
3f061c5e5d
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Reproduces the Testcontainers + Spring context-cache trap: a per-class @Container is stopped after
|
||||
# the first test class, but Spring reuses the cached ApplicationContext (and its connection pool) for the next one.
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
OUT="$HERE/output/09-container-lifecycle-trap.txt"
|
||||
WORK="$(mktemp -d)"
|
||||
mkdir -p "$WORK/m" && cp -r "$HERE/pom.xml" "$HERE/src" "$WORK/m/"
|
||||
cd "$WORK/m"
|
||||
python3 - <<'PY'
|
||||
p='src/test/java/com/ankurm/jooq/PostgresTestBase.java'
|
||||
s=open(p).read()
|
||||
s=s.replace('@SpringBootTest\nabstract','@org.testcontainers.junit.jupiter.Testcontainers\n@SpringBootTest\nabstract')
|
||||
s=s.replace(' @ServiceConnection\n static final PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:17-alpine");\n\n static {\n postgres.start();\n }\n',
|
||||
' @org.testcontainers.junit.jupiter.Container\n @ServiceConnection\n static PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:17-alpine");\n')
|
||||
open(p,'w').write(s)
|
||||
PY
|
||||
{
|
||||
echo "per-class @Container, two test classes sharing one cached Spring context (hikari connection-timeout shortened to 2 s)"
|
||||
mvn -B -q test -DargLine="-Dspring.datasource.hikari.connection-timeout=2000" -Dtest='TransactionTests,QueryTests' 2>&1 \
|
||||
| grep -E 'Tests run:|TransientDataAccessResourceException|Connection is not available|Failed to validate connection' | sed 's/^[0-9:.]* //' | sed -E 's/PgConnection@[0-9a-f]+/PgConnection@HASH/; s/^[0-9T:.+-]+ +//' | sort | uniq -c | sed 's/^ *//' | cut -c1-260 | head -12
|
||||
} > "$OUT"
|
||||
cd "$HERE"; rm -rf "$WORK"
|
||||
cat "$OUT"
|
||||
Reference in New Issue
Block a user