Skip to content

Commit ca747ea

Browse files
Check in CI that data survives a Docker restart
The docker job now records an attempt, stops the stack without removing volumes, starts it again, logs in with the same account and checks the attempt is still there. This covers the last step of the V3 success criteria, which nothing tested before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e05296c commit ca747ea

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ jobs:
151151

152152
- name: Wait for the backend to become healthy
153153
run: |
154+
cat > wait-for-backend.sh <<'EOF'
154155
for i in $(seq 1 60); do
155156
if curl -sf http://localhost:8000/health > /dev/null; then
156157
echo "backend healthy after ${i} tries"
@@ -160,6 +161,8 @@ jobs:
160161
done
161162
echo "backend did not become healthy" >&2
162163
exit 1
164+
EOF
165+
bash wait-for-backend.sh
163166
164167
- name: Smoke test through nginx
165168
run: |
@@ -177,6 +180,25 @@ jobs:
177180
http://localhost:8080/api/auth/register > /dev/null
178181
curl -sf -b cookies.txt http://localhost:8080/api/sekiro/analytics | jq -e '.total_bosses == '"${bosses}"
179182
183+
# An attempt for the persistence check below.
184+
curl -sf -b cookies.txt -H 'Content-Type: application/json' \
185+
-d '{"result": "failed", "phase_reached": 1, "failure_move_id": null, "failure_category": "not_sure", "notes": "persistence check"}' \
186+
http://localhost:8080/api/bosses/genichiro-ashina/attempts > /dev/null
187+
188+
# Stopping the stack without -v must keep accounts and attempts in the
189+
# postgres-data volume (V3 success criteria: restart, data persists).
190+
- name: Restart the stack and check the data persisted
191+
run: |
192+
docker compose down
193+
docker compose up -d
194+
bash wait-for-backend.sh
195+
196+
curl -sf -c cookies-after.txt -H 'Content-Type: application/json' \
197+
-d '{"username": "ci_smoke", "password": "ci-smoke-password"}' \
198+
http://localhost:8080/api/auth/login > /dev/null
199+
curl -sf -b cookies-after.txt http://localhost:8080/api/bosses/genichiro-ashina/attempts \
200+
| jq -e 'length == 1 and .[0].notes == "persistence check"'
201+
180202
- name: Show container logs
181203
if: failure()
182204
run: docker compose logs

0 commit comments

Comments
 (0)