Build persistent Compose stack and verify full restart

This commit is contained in:
Самохвалов Андрей Ремович
2026-10-02 10:55:08 +03:00
parent ea984c0af3
commit ed7a27629d
8 changed files with 181 additions and 23 deletions
+30
View File
@@ -0,0 +1,30 @@
Lab 2 local Compose verification, 2026-10-02 (UTC timestamps)
Checks ran on the macOS host with Docker socket and loopback access enabled;
the restricted sandbox could not reach 127.0.0.1:8080. No VM-local run or
SSH tunnel was used.
docker compose --env-file .env config --quiet -> exit 0
docker compose --env-file .env up -d --build --wait -> API and PostgreSQL healthy
make test BASE_URL=http://127.0.0.1:8080 -> PASS: lab2 public API scenario
make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://127.0.0.1:8080
-> PASS: persistence preserved confirmed data and existing session
docker inspect before persistence hook:
api 2026-10-02T07:18:38.19716Z
postgres 2026-10-02T07:18:37.971410919Z
docker inspect after persistence hook:
api 2026-10-02T07:20:21.164948401Z
postgres 2026-10-02T07:20:18.602237039Z
Both service StartedAt values changed; container IDs stayed constant. Compose retained
the named mtusi2026lab2_postgres_data volume. No volume deletion or seed occurred.
With PostgreSQL stopped, GET /health/ready and GET /api/v1/users/me with a
syntactically valid but unknown Bearer each returned HTTP 503. Compose then
started PostgreSQL again; both services returned healthy.
After recovery, make test passed again. Querying schema_migrations returned
one row for version 1 and one row for version 2 after repeated migration runs.
make check -> PASS: offline skeleton structure, local refs and Python syntax
make validate PYTHON=.venv/bin/python -> not run successfully: the pinned
openapi-spec-validator package was absent and pip could not resolve
files.pythonhosted.org in this environment. The CI job installs it separately.