Files
spring-boot-demo/idempotency/scripts/timezone-trap.sh
T
asmhatreandClaude Sonnet 5.5 6a36e84858 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
2026-11-08 18:22:05 +00:00

29 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Shows why the tests pin -Duser.timezone=UTC. pgjdbc sends the JVM's default zone to Postgres as
# the TimeZone startup parameter. A JVM whose zone is the legacy id Asia/Calcutta then fails with
# FATAL: invalid value for parameter "TimeZone": "Asia/Calcutta"
# on a Postgres whose tzdata lacks the legacy alias. Needs psql and a database reachable with
# IDEM_DB_* (defaults match application.yml). Writes output/00-timezone-trap.txt.
set -uo pipefail
cd "$(dirname "$0")/.."
mkdir -p output
export PGPASSWORD="${IDEM_DB_PASSWORD:-idem}"
P=(psql -h "${IDEM_DB_HOST:-localhost}" -U "${IDEM_DB_USER:-idem}" "${IDEM_DB_NAME:-idem}")
{
echo "\$ psql -c \"SHOW server_version\""
"${P[@]}" -t -A -c "SHOW server_version" 2>&1
echo
echo "\$ psql -c \"SET timezone='Asia/Calcutta'\""
"${P[@]}" -c "SET timezone='Asia/Calcutta'" 2>&1
echo
echo "\$ psql -c \"SET timezone='Asia/Kolkata'\""
"${P[@]}" -c "SET timezone='Asia/Kolkata'" 2>&1
echo
echo "\$ ls /usr/share/zoneinfo/Asia | grep -E 'Calcutta|Kolkata'"
ls /usr/share/zoneinfo/Asia | grep -E 'Calcutta|Kolkata'
echo
echo "\$ dpkg -l tzdata | tail -1"
dpkg -l tzdata | tail -1 | awk '{print $2, $3}'
} > output/00-timezone-trap.txt
cat output/00-timezone-trap.txt