# Persistence hook scope: real container restarts, volumes preserved
$ docker inspect before
/api started=2026-10-20T13:43:34.744581601Z restarts=0
/postgres started=2026-10-20T13:45:47.006469682Z restarts=0
/redis started=2026-10-20T13:45:33.276541726Z restarts=0

$ make test-persistence BASE_URL=http://172.18.0.1:8080 ACTION_SCRIPT=scripts/restart.sh
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://172.18.0.1:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.

$ docker inspect after
/api started=2026-10-20T13:46:01.985254148Z restarts=0
/postgres started=2026-10-20T13:46:00.989433719Z restarts=0
/redis started=2026-10-20T13:46:01.023470617Z restarts=0

$ docker compose ps
NAME                            IMAGE                                                                     COMMAND                  SERVICE         CREATED          STATUS                   PORTS
mtusi2026lab2-api-1             sha256:4e5079fddfd7792f1ccf90891259fc4d737a8486a7a92461dcd72c6b0fd6914d   "/usr/local/bin/serv…"   api             2 minutes ago    Up 5 seconds (healthy)   0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
mtusi2026lab2-api-short-ttl-1   mtusi2026lab2-api-short-ttl                                               "/usr/local/bin/serv…"   api-short-ttl   2 minutes ago    Up 2 minutes (healthy)   0.0.0.0:8081->8080/tcp, [::]:8081->8080/tcp
mtusi2026lab2-postgres-1        postgres:16.10-alpine                                                     "docker-entrypoint.s…"   postgres        10 minutes ago   Up 6 seconds (healthy)   5432/tcp
mtusi2026lab2-redis-1           redis:7.4.7-alpine                                                        "docker-entrypoint.s…"   redis           10 minutes ago   Up 6 seconds (healthy)   6379/tcp

$ docker volume ls (project volumes)
mtusi2026lab2_pgdata
mtusi2026lab2_redisdata

$ redis AOF files
total 20
-rw-------    1 redis    redis           88 Oct 20 13:35 appendonly.aof.1.base.rdb
-rw-------    1 redis    redis        11185 Oct 20 13:46 appendonly.aof.1.incr.aof
-rw-------    1 redis    redis           88 Oct 20 13:35 appendonly.aof.manifest
