Add idempotency module: Idempotency-Key for POST APIs on Spring Boot 4.1.2 with Redis and Postgres stores
One servlet filter, two interchangeable stores, 18 tests (9 scenarios x 2 stores) against a real redis-server 7.0.15 and PostgreSQL 16.15, and 20 captured transcripts under output/: replay, 422 on a changed body, concurrent duplicates, expiry, the crash window and a handler slower than the lock. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5yg8grY17JsVAJviV
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file under output/.
|
||||
#
|
||||
# ./scripts/run-all.sh
|
||||
#
|
||||
# Needs JDK 25, Maven 3.9, redis-server and redis-cli (7.x) on the PATH, and a PostgreSQL 14+ that
|
||||
# the application can reach (IDEM_DB_URL / IDEM_DB_USER / IDEM_DB_PASSWORD, default
|
||||
# jdbc:postgresql://localhost:5432/idem as idem/idem). The tests start a throwaway redis-server on a
|
||||
# free port; they do truncate the payments and idempotency_keys tables in that database.
|
||||
# Transcripts 01-08 come out of the test suite, so each line in them is an assertion that fails the
|
||||
# build when it stops being true. Transcript 00 is psql, run by scripts/timezone-trap.sh.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p output
|
||||
|
||||
echo "== time zone trap (transcript 00)"
|
||||
./scripts/timezone-trap.sh >/dev/null || true
|
||||
|
||||
echo "== test suite (transcripts 01-08, two stores)"
|
||||
mvn -B test | tee /tmp/idempotency-mvn.log | grep -E '^\[(INFO|WARNING|ERROR)\] Tests run:' | sed 's/^\[[A-Z]*\] //' > output/09-test-summary.txt
|
||||
|
||||
echo
|
||||
echo "output:"
|
||||
ls -1 output
|
||||
Reference in New Issue
Block a user