ЛР 2: закрыть уровень 4
Завершить PostgreSQL, Redis-сессии, миграции, таймауты и диагностику. Зафиксировать собственные тесты и доказательства финального прогона: 43 PASS, 0 FAIL, 0 SKIP; 768 HTTP-запросов без ошибок. Добавить официальный отчёт с запуском, архитектурой, SQL-планами и ограничениями. PR отложен до завершения уровня 5.
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
# Повторная проверка auth — 13.10.2026
|
||||
|
||||
Итог: **FAIL**. Многие прежние ошибки исправлены, но найдены четыре действующих
|
||||
нарушения. Приложение во время проверки не менялось.
|
||||
|
||||
## Подтверждённые проблемы
|
||||
|
||||
1. **Logout зарегистрирован по неверному пути.**
|
||||
`internal/transport/http/router.go:32` использует
|
||||
`DELETE /api/v1/auth/current`. Контракт требует
|
||||
`DELETE /api/v1/auth/sessions/current`. На обязательном пути действительный
|
||||
токен получает 404 вместо 204. Падают публичный smoke, Go routing test,
|
||||
обычный HTTP logout test и auth persistence до выполнения restart hook.
|
||||
Отдельная диагностика существующего альтернативного пути дала 204; токен
|
||||
после этого получает 401, включая рестарт и восстановление БД. Сама операция
|
||||
отзыва работает, но альтернативный путь не засчитывается по контракту.
|
||||
|
||||
2. **Вход всё ещё принимает JSON body.**
|
||||
`internal/transport/http/handler/auth.go:29` вызывает CreateSession без
|
||||
проверки тела. С корректным Basic и JSON body сервер возвращает 201 вместо
|
||||
400 invalid_request. Компонентный тест дополнительно подтвердил побочный
|
||||
эффект: в sessions появилась запись. Источник: contracts/README.md,
|
||||
раздел «Идентификация и сессии»: вход только через Basic, без JSON body.
|
||||
|
||||
3. **Остановка настоящего PostgreSQL всё ещё даёт HTTP 500.**
|
||||
С действительной сессией GET /users/me возвращает 500 вместо 503 unavailable.
|
||||
То же воспроизведено для регистрации, входа и запроса logout. Неизвестный
|
||||
Bearer также получил 500 в общей dependency suite. При этом Go-тест с
|
||||
net.OpError/ECONNREFUSED проходит: такое исключение теперь обрабатывается.
|
||||
Классификация в `../../internal/repository/errors.go:20` ещё не покрывает
|
||||
весь наблюдаемый отказ соединения: необработанная ошибка попадает в
|
||||
ErrDatabase, затем в 500 internal_error. Точный низкоуровневый тип каждого
|
||||
реального отказа в данном прогоне не снимался; HTTP-результат подтверждён.
|
||||
При восстановлении PostgreSQL прежние сессии снова работают.
|
||||
|
||||
4. **Readiness возвращает неверный JSON ошибки.**
|
||||
`internal/transport/http/handler/health.go:31`: при отказе БД HTTP-код теперь
|
||||
правильный — 503, но тело равно {"status":"unavailable"}. Обязательны
|
||||
общая схема Error и error.code=unavailable, message, request_id, совпадающий
|
||||
с X-Request-Id. contracts/README.md и OpenAPI /health/ready responses/503
|
||||
явно задают общий формат ошибки. Публичный client.py отвергает нынешнее тело.
|
||||
/health/live остаётся 200 при остановленной БД, что соответствует контракту.
|
||||
|
||||
## Результаты запуска
|
||||
|
||||
| Проверка | Результат |
|
||||
| --- | --- |
|
||||
| Сборка текущих API и migrate, Compose config | PASS |
|
||||
| make check | PASS, проверка структуры и контракта |
|
||||
| make validate через подготовленный временный venv | PASS, полная OpenAPI 3.1/schema |
|
||||
| go test -race ./... -count=1 -json с настоящим PostgreSQL | 19 PASS, 2 FAIL, 0 SKIP |
|
||||
| Go мигратор: 6 тестов, пустая схема/повтор/конкуренция/rollback | PASS |
|
||||
| Go пароли, middleware, хранение, expiry, rollback чата | PASS кроме body и logout routing |
|
||||
| make test, неизменённый публичный smoke | FAIL на logout, предшествующие шаги завершены |
|
||||
| student-tests/auth_contract.py normal | 14 PASS / 16, два падения: body и logout |
|
||||
| Публичный test-persistence | PASS: API и PostgreSQL реально перезапущены |
|
||||
| HTTP auth persistence | FAIL до hook на обязательном logout |
|
||||
| HTTP auth dependency/PostgreSQL | FAIL: 500 при остановленной БД |
|
||||
| HTTP expiry на отдельном API с SESSION_TTL_SECONDS=2 | PASS |
|
||||
| Дополнительная проверка настоящего полного рестарта | PASS: исходный выданный через API токен, сообщения и expires_at сохранены |
|
||||
| Отказ, восстановление и ранее отозванный токен | Проблемы 503 выше подтверждены; после восстановления сессии корректны |
|
||||
|
||||
Go-падения: TestStorageAuthHandlerRejectsJSONBody,
|
||||
TestStorageHTTPAuthRoutingAndLogout. Все Go-интеграционные тесты действительно
|
||||
выполнены с БД; переменные AUTH_TEST_DATABASE_URL и MIGRATE_TEST_DATABASE_URL
|
||||
переданы только тестовым процессам, значения в логах не сохранялись.
|
||||
|
||||
Обычные HTTP-проверки подтвердили, в частности, Unicode-границы password,
|
||||
двоеточие и значимые пробелы, запрет полностью пробельных password, KDF,
|
||||
одинаковые ошибки неверных credentials, уникальность username в гонке,
|
||||
игнорирование X-User-Id, ACL/отправителя, rollback чата, TTL, opaque токены,
|
||||
отсутствие второго JSON-ответа и аутентификацию перед валидацией.
|
||||
|
||||
## Стенд и достоверность
|
||||
|
||||
Тестовый Docker-проект: highload-auth-retest-658e0bd7. С нуля создан собственный
|
||||
volume; использованы новые синтетические secrets, отдельные фиксированные
|
||||
localhost-порты, свежесобранные образы текущего кода. Рабочая БД и её secrets
|
||||
не использовались. Основной API работал с TTL 3600, отдельный процесс того же
|
||||
образа — с TTL 2. Данные создавались через настоящий HTTP login; диагностическая
|
||||
подстановка сессий в SQL, как в первом обзоре, больше не требовалась.
|
||||
|
||||
Временные явные hooks restart/failure/recovery действовали только на этот
|
||||
проект. hook-proof.jsonl содержит started_at обоих контейнеров до и после,
|
||||
а также неизменное имя PostgreSQL volume. Для публичного persistence hook
|
||||
перезапустил API и PostgreSQL, сохранив volume. Диагностика дополнительно
|
||||
проверила исходный expires_at и отзыв сессии через реально существующий путь.
|
||||
|
||||
Первый запуск временного api_expiry был некорректен: extends наследовал только
|
||||
часть временного override и не подключил secret. Этот запуск не засчитан.
|
||||
Добавлены secret mount и зависимости исключительно в /tmp/compose.test.yaml;
|
||||
expiry повторён успешно. Приложение для исправления стенда не менялось.
|
||||
|
||||
После проверки временный проект, включая api_expiry и его собственный volume,
|
||||
удалён: cleanup exit 0. source-before.json / source-verification.json подтверждают
|
||||
отсутствие изменений internal/, cmd/ без тестов, db/ и основных Compose,
|
||||
Dockerfiles, go.mod/go.sum во время прогона.
|
||||
|
||||
Единственные изменения существующих тестов: новый HealthHandler передан
|
||||
в тестовый NewRouter под новую сигнатуру пользователя; обновлён устаревший
|
||||
комментарий. Assertions не ослаблялись. AUTH_TESTS.md обновлён результатами.
|
||||
|
||||
Преподавательские contracts/, tests/, scripts/, README, COURSE, CONTRIBUTING,
|
||||
MAINTAINERS, Makefile, lab.json сравнены с архивом преподавателя от 13.10.2026:
|
||||
18 исходных файлов, различий нет. Нормативный источник:
|
||||
[репозиторий lab2](https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2).
|
||||
|
||||
## Что эта проверка ещё не закрывает
|
||||
|
||||
- В репозитории пока нет scripts/restart.sh. Публичный persistence прошёл
|
||||
с явно подготовленным временным hook; для воспроизводимой сдачи нужен
|
||||
собственный executable hook в репозитории.
|
||||
- Redis/Valkey пока отсутствует по договорённости и не проверялся. Это не
|
||||
подтверждение готовности на 4/5; планы EXPLAIN >=10k и эксперимент на 5
|
||||
в данном прогоне не выполнялись.
|
||||
- Старые HTTP/container suites из lab1 не адаптированы под регистрацию с
|
||||
password, Bearer и persistence. Их выполнение не засчитывается как lab2
|
||||
регрессия. Go ./... их исходники компилирует, но не выполняет эти сценарии.
|
||||
- Конечный набор проверок подтверждает перечисленные сценарии, а не отсутствие
|
||||
любых ошибок. Ошибки приложения оставлены пользователю для исправления.
|
||||
|
||||
Основные доказательства: summary.json, go-all-race.log, auth-normal.log,
|
||||
teacher-smoke.log, teacher-persistence.log, auth-expiry.log,
|
||||
focused-diagnostics.json, readiness-outage-shape.json, hook-proof.jsonl,
|
||||
images.json, cleanup.log. Пароли и bearer-токены в evidence не записаны.
|
||||
@@ -0,0 +1,39 @@
|
||||
services:
|
||||
api:
|
||||
image: highload-auth-retest-658e0bd7-api:latest
|
||||
ports: !override
|
||||
- "127.0.0.1:61029:8080"
|
||||
environment:
|
||||
APP_HOST: 0.0.0.0
|
||||
APP_PORT: "8080"
|
||||
SESSION_TTL_SECONDS: "3600"
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
postgres:
|
||||
ports: !override
|
||||
- "127.0.0.1:61030:5432"
|
||||
api_expiry:
|
||||
extends:
|
||||
service: api
|
||||
image: highload-auth-retest-658e0bd7-api:latest
|
||||
profiles: [expiry]
|
||||
secrets:
|
||||
- database_url
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
cap_drop: [ALL]
|
||||
security_opt: [no-new-privileges:true]
|
||||
stop_grace_period: 20s
|
||||
ports: !override
|
||||
- "127.0.0.1:61031:8080"
|
||||
environment:
|
||||
SESSION_TTL_SECONDS: "2"
|
||||
secrets:
|
||||
database_url:
|
||||
file: /tmp/highload-auth-retest-658e0bd7/database_url
|
||||
postgres_password:
|
||||
file: /tmp/highload-auth-retest-658e0bd7/postgres_password
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"scope": "actual sessions issued by HTTP API; alternate logout route is diagnostic only and does not satisfy contract",
|
||||
"results": [
|
||||
{
|
||||
"check": "working login and Bearer identity",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "required logout route returns 204",
|
||||
"status": "FAIL",
|
||||
"detail": "DELETE /api/v1/auth/sessions/current: expected [204], received 404"
|
||||
},
|
||||
{
|
||||
"check": "implemented alternate logout route revokes its token",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "revoked session is rejected",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "actual issued token messages and expiry survive full API/Postgres restart",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "live stays 200 during PostgreSQL outage",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "anonymous request stays 401 during outage",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "ready 503 follows Error schema",
|
||||
"status": "FAIL",
|
||||
"detail": "response: missing required fields"
|
||||
},
|
||||
{
|
||||
"check": "valid Bearer request returns 503 unavailable during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "GET /api/v1/users/me: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "registration returns 503 during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "POST /api/v1/users: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "login returns 503 during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "POST /api/v1/auth/sessions: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "logout does not succeed during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "DELETE /api/v1/auth/sessions/current: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "original session recovers after PostgreSQL returns",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "revoked token remains revoked after database recovery",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "restart evidence shows both processes restarted with same volume",
|
||||
"status": "PASS"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import datetime as dt,hashlib,json,pathlib,subprocess,sys,time
|
||||
s=json.loads(pathlib.Path('/tmp/highload-current-auth-retest.json').read_text());tmp=pathlib.Path(s['tmp']);root=pathlib.Path(s['root'])
|
||||
sys.path.insert(0,str(root/'tests'));from client import Client,Failure,check
|
||||
assert s['project'].startswith('highload-auth-retest-')
|
||||
base=['docker','compose','-p',s['project'],'--project-directory',str(root),'-f',str(root/'compose.yaml'),'-f',str(tmp/'compose.test.yaml')]
|
||||
c=Client(s['base_url'],timeout=5);results=[]
|
||||
def record(name,fn):
|
||||
try:fn();results.append({'check':name,'status':'PASS'})
|
||||
except (Failure,ValueError,OSError,subprocess.SubprocessError) as e:results.append({'check':name,'status':'FAIL','detail':str(e) if isinstance(e,Failure) else type(e).__name__})
|
||||
print(name+': '+results[-1]['status'],flush=True)
|
||||
def hook(action):
|
||||
p=subprocess.run([str(tmp/('test-'+action))],capture_output=True,text=True,timeout=90)
|
||||
check(p.returncode==0,'controlled '+action+' hook failed')
|
||||
def sql(statement):
|
||||
p=subprocess.run(base+['exec','-T','postgres','psql','-X','-qAt','-v','ON_ERROR_STOP=1','-U','messenger','-d','messenger'],input=statement+'\n',capture_output=True,text=True,timeout=10)
|
||||
check(p.returncode==0,'SQL fixture inspection failed (details suppressed)');return p.stdout.strip()
|
||||
a,b,e=c.user('probe_a'),c.user('probe_b'),c.user('probe_e')
|
||||
room=c.call('POST','/api/v1/chats',201,actor=a,body={'title':'Focused retest','member_ids':[a['id'],b['id']]},schema='Chat')['json']
|
||||
original=c.message(a,room,'Confirmed before full restart')['json']
|
||||
hash_value=hashlib.sha256(a['token'].encode()).hexdigest()
|
||||
lookup="SELECT expires_at FROM sessions WHERE token_hash=decode('"+hash_value+"','hex');"
|
||||
before=sql(lookup)
|
||||
record('working login and Bearer identity',lambda:check(c.call('GET','/api/v1/users/me',actor=a,schema='User')['json']==a['user'],'wrong session identity'))
|
||||
record('required logout route returns 204',lambda:c.call('DELETE','/api/v1/auth/sessions/current',204,actor=e))
|
||||
# This diagnostic confirms revocation implementation separately from the wrong route.
|
||||
record('implemented alternate logout route revokes its token',lambda:c.call('DELETE','/api/v1/auth/current',204,actor=e))
|
||||
record('revoked session is rejected',lambda:c.call('GET','/api/v1/users/me',401,actor=e))
|
||||
def full_restart():
|
||||
hook('restart')
|
||||
check(c.call('GET','/api/v1/users/me',actor=a,schema='User')['json']==a['user'],'existing session/user lost across restart')
|
||||
check(c.call('GET','/api/v1/chats/'+room['id']+'/messages',actor=b,schema='MessagePage')['json']['items']==[original],'confirmed message changed')
|
||||
check(sql(lookup)==before,'full restart or read extended stored expiry')
|
||||
record('actual issued token messages and expiry survive full API/Postgres restart',full_restart)
|
||||
try:
|
||||
hook('failure')
|
||||
record('live stays 200 during PostgreSQL outage',lambda:c.call('GET','/health/live',schema='Health'))
|
||||
record('anonymous request stays 401 during outage',lambda:c.call('GET','/api/v1/users/me',401))
|
||||
record('ready 503 follows Error schema',lambda:c.call('GET','/health/ready',503))
|
||||
# Save only the health status and response field names, no credentials.
|
||||
import urllib.request,urllib.error
|
||||
try:
|
||||
urllib.request.urlopen(s['base_url']+'/health/ready',timeout=5)
|
||||
except urllib.error.HTTPError as response:
|
||||
payload=json.load(response)
|
||||
(tmp/'readiness-outage-shape.json').write_text(json.dumps({'status':response.code,'body':payload,'x_request_id_present':bool(response.headers.get('X-Request-Id'))},indent=2))
|
||||
record('valid Bearer request returns 503 unavailable during outage',lambda:check(c.call('GET','/api/v1/users/me',503,actor=a)['json']['error']['code']=='unavailable','wrong outage error'))
|
||||
record('registration returns 503 during outage',lambda:c.call('POST','/api/v1/users',503,body={'username':'outage_'+hash_value[:16],'display_name':'Outage','password':'Synthetic-Outage-Fixture-123'}))
|
||||
import base64
|
||||
headers={'Authorization':'Basic '+base64.b64encode((a['registration']['username']+':'+a['registration']['password']).encode()).decode()}
|
||||
record('login returns 503 during outage',lambda:c.call('POST','/api/v1/auth/sessions',503,headers=headers))
|
||||
record('logout does not succeed during outage',lambda:c.call('DELETE','/api/v1/auth/sessions/current',503,actor=a))
|
||||
finally:hook('recovery')
|
||||
record('original session recovers after PostgreSQL returns',lambda:check(c.call('GET','/api/v1/users/me',actor=a,schema='User')['json']==a['user'],'session changed after recovery'))
|
||||
record('revoked token remains revoked after database recovery',lambda:c.call('GET','/api/v1/users/me',401,actor=e))
|
||||
proofs=[json.loads(line) for line in (tmp/'hook-proof.jsonl').read_text().splitlines()]
|
||||
def restart_proof():
|
||||
restarts=[p for p in proofs if p['action']=='restart'];check(bool(restarts),'restart hook never executed')
|
||||
for p in restarts:
|
||||
for svc in ('api','postgres'):check(p['before'][svc]['started_at']!=p['after'][svc]['started_at'] and p['after'][svc]['running'],'service was not restarted')
|
||||
check(p['before']['postgres']['volumes']==p['after']['postgres']['volumes'],'restart changed PostgreSQL volume')
|
||||
record('restart evidence shows both processes restarted with same volume',restart_proof)
|
||||
(tmp/'focused-diagnostics.json').write_text(json.dumps({'scope':'actual sessions issued by HTTP API; alternate logout route is diagnostic only and does not satisfy contract','results':results},indent=2))
|
||||
raise SystemExit(0 if all(x['status']=='PASS' for x in results) else 1)
|
||||
@@ -0,0 +1,6 @@
|
||||
{"action": "restart", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:50:36.793997345Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:50:30.5187363Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:20.720018462Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
{"action": "failure", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:20.720018462Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:20.720018462Z", "running": false, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
{"action": "recovery", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:20.720018462Z", "running": false, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:25.79699384Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
{"action": "restart", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:52:22.819556005Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:52:25.79699384Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:55:21.419539963Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:55:20.600955921Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
{"action": "failure", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:55:21.419539963Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:55:20.600955921Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:55:21.419539963Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:55:20.600955921Z", "running": false, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
{"action": "recovery", "before": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:55:21.419539963Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:55:20.600955921Z", "running": false, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}, "after": {"api": {"id": "657b6866b9a0ccd474b608d81749c130cbb66ce9f4fdcf00f09a47409b27275b", "started_at": "2026-10-13T18:55:21.419539963Z", "running": true, "volumes": []}, "postgres": {"id": "8930cb53b583c53f8f699deb98a91f06776c83ec2812dea9a732f7103fd883bb", "started_at": "2026-10-13T18:55:23.087144463Z", "running": true, "volumes": ["highload-auth-retest-658e0bd7_postgres_data"]}}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"api": "sha256:bba5308b98efe7c4219186268a32e63dd34391e275ffe3bbe07c6e87ebadbe8b",
|
||||
"migrate": "sha256:73a3536605ad237c3371d664ca2690868ff5adc5ff33f1079c5e8f777641e20b",
|
||||
"postgres": "sha256:5a5a84b19854a9ffaa54082c166ff4ec27473a361e496e5ea167f298f2da9722",
|
||||
"api_expiry": "sha256:bba5308b98efe7c4219186268a32e63dd34391e275ffe3bbe07c6e87ebadbe8b"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"status": 503,
|
||||
"body": {
|
||||
"status": "unavailable"
|
||||
},
|
||||
"x_request_id_present": true
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import json,os,pathlib,subprocess,time,urllib.request,urllib.error
|
||||
s=json.loads(pathlib.Path('/tmp/highload-current-auth-retest.json').read_text());root=pathlib.Path(s['root']);tmp=pathlib.Path(s['tmp'])
|
||||
assert s['project'].startswith('highload-auth-retest-')
|
||||
base=['docker','compose','-p',s['project'],'--project-directory',str(root),'-f',str(root/'compose.yaml'),'-f',str(tmp/'compose.test.yaml')]
|
||||
results=[]
|
||||
def run(args,label,env=None):
|
||||
try:
|
||||
p=subprocess.run(args,cwd=root,env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True,timeout=180)
|
||||
code=p.returncode;out=p.stdout
|
||||
except subprocess.TimeoutExpired:
|
||||
code=124;out='Test command exceeded 180 seconds; results incomplete.\n'
|
||||
(tmp/(label+'.log')).write_text(out)
|
||||
result={'check':label,'exit_code':code,'status':'PASS' if code==0 else 'FAIL'}
|
||||
results.append(result);print(label+': '+result['status'],flush=True)
|
||||
(tmp/'suite-summary.json').write_text(json.dumps(results,indent=2))
|
||||
return code
|
||||
|
||||
def ready(url):
|
||||
deadline=time.monotonic()+45
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(url+'/health/ready',timeout=3) as response:
|
||||
if response.status==200:return
|
||||
except (OSError,urllib.error.URLError):pass
|
||||
if time.monotonic()>deadline:raise RuntimeError('test API not ready')
|
||||
time.sleep(.2)
|
||||
ready(s['base_url'])
|
||||
env=os.environ.copy();db='postgres://messenger:'+(tmp/'postgres_password').read_text()+'@127.0.0.1:'+str(s['pg_port'])+'/messenger?sslmode=disable'
|
||||
env['AUTH_TEST_DATABASE_URL']=db;env['MIGRATE_TEST_DATABASE_URL']=db
|
||||
run(['make','check'],'teacher-check')
|
||||
run(['make','validate','PYTHON=/tmp/highload-auth-review-venv/bin/python'],'teacher-openapi')
|
||||
run(['go','test','-race','./...','-count=1','-json'],'go-all-race',env)
|
||||
run(['make','test','BASE_URL='+s['base_url']],'teacher-smoke')
|
||||
run(['python3','student-tests/auth_contract.py','--base-url',s['base_url'],'--ttl','3600'],'auth-normal')
|
||||
run(['make','test-persistence','BASE_URL='+s['base_url'],'ACTION_SCRIPT='+str(tmp/'test-restart')],'teacher-persistence')
|
||||
run(['python3','student-tests/auth_contract.py','--suite','persistence','--base-url',s['base_url'],'--ttl','3600','--restart-hook',str(tmp/'test-restart'),'--hook-timeout','60'],'auth-persistence')
|
||||
run(['python3','student-tests/auth_contract.py','--suite','dependency','--dependency','postgres','--base-url',s['base_url'],'--ttl','3600','--failure-hook',str(tmp/'test-failure'),'--recovery-hook',str(tmp/'test-recovery'),'--hook-timeout','60','--timeout','5'],'auth-dependency')
|
||||
# Same newly built API image, separate process with short TTL.
|
||||
if run(base+['up','-d','--no-build','api_expiry'],'start-expiry-api')==0:
|
||||
ready(s['expiry_url'])
|
||||
run(['python3','student-tests/auth_contract.py','--suite','expiry','--base-url',s['expiry_url'],'--ttl','2'],'auth-expiry')
|
||||
print('Suites completed; keep disposable project for focused diagnostics.',flush=True)
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"internal/.DS_Store": "1585ae06c37a6ef7532657745416b3fd4b62de626153b376060beb7b4e7fdbd7",
|
||||
"internal/database/.DS_Store": "4b2956f86b6dd1d079e63d442aa22d02c3691919508bfc477b7ca21929af5589",
|
||||
"internal/database/database.go": "c009ab86a3c1b3ca0a153c12fee3a656be094583c2a811ef972d46d8b3300e70",
|
||||
"internal/config/config.go": "6fc7c51652850dbd37c27c52170af16375ca8d8ba28110c6889bb37387c635e8",
|
||||
"internal/security/password.go": "8f74bef9216a2d12aa734e04fa786eac6b31f1378fe42f729fe1b97495c10487",
|
||||
"internal/model/user.go": "4bfd2d78e72f1c80b12541f2abc8500613e8f4d101575bd5d74fac22b52e3617",
|
||||
"internal/model/message.go": "b9ce1bdc5fd8ccf20d18033f56ac47c8a64352584ee29ab27915535557003a72",
|
||||
"internal/model/session.go": "b455d730e4e3efc95c6d1fe74ab43d86153e4bf863c09efd36bfe57efc669bc2",
|
||||
"internal/model/chat.go": "e0213f8360ea106b3627aa50cc87710153ff8e353475b42c2becdb9a32592660",
|
||||
"internal/service/user.go": "7e66b883bdbfa7130d999546f4523c7962192cf4b492a6455b1816299bc70a1d",
|
||||
"internal/service/auth.go": "feb29e6bf3deba85144fa1940c75314e76cc7ff7cc2fd0054feb869d63259018",
|
||||
"internal/service/message.go": "f673e624e610ab794008bd12c33069a6f3f21fd8c50304bb878a13900b3212b9",
|
||||
"internal/service/helper.go": "22f9a560c5e15186fd707b3b7bd2f0691e278a082e1b22b058b8d8f7ece48df8",
|
||||
"internal/service/chat.go": "114dc6e5c3f582be03d44db7ab2d75173f243f33872be11d462798df9ce68993",
|
||||
"internal/service/errors.go": "5b66aba837168d5e942cbc0bbbc1b61bc9bd8a4dea30b904071660030a5dd197",
|
||||
"internal/transport/http/router.go": "44f50903b4cbbd45526973f896e2ccdea3f17d920f7d8d56e59cabd6ef7a0cf6",
|
||||
"internal/transport/http/handler/chat_types.go": "d181bce0f003749d813c1254df4c8ebcc1b99ff506b61efa6899da4a499e95f4",
|
||||
"internal/transport/http/handler/user.go": "86fd65ed176e9a83dc27c1112ff8384bc5aa32a92410290fb505d715ca167775",
|
||||
"internal/transport/http/handler/auth.go": "ef228e93a5c4bdd2f07cce447cfca38863631a0eab892cb27b56e357632c4d3b",
|
||||
"internal/transport/http/handler/message.go": "43dfcabbd24fe809e407958fed34bf567bdc6dd45c61f06c2e6d6bdd3d68b3ed",
|
||||
"internal/transport/http/handler/health.go": "d9929b50c79ce96f6444fc2dcac6266a5b123447ec13b63249f823f8bdb1dfe2",
|
||||
"internal/transport/http/handler/chat.go": "e5214ebf94ac9b8f37537e1a3fc844a2e8ae4e9b5aa159fe2b6e4da9ab2342f0",
|
||||
"internal/transport/http/handler/auth_types.go": "5ffcd182606a77d538efb5f1a51df23b8a324a605b5d226026048d34c409ebdb",
|
||||
"internal/transport/http/handler/health_types.go": "02ee3031e10fbb279e020f409fbd905ae2640aa306b2c558c3f8e6dcfe9efa80",
|
||||
"internal/transport/http/handler/message_types.go": "b7649808c889cc9518bf5710415550abf4bed9ad5052a327c88181ed3b45aafc",
|
||||
"internal/transport/http/handler/user_types.go": "0c4450be649afe5edf4e8d3ac9baada79deb9e1423ace56b87aa227ebd0eb998",
|
||||
"internal/transport/http/middleware/auth.go": "28c1d54da2c371289a3ad2aaeb8365135a38b0afe555a7cffcec0128ee7491b8",
|
||||
"internal/transport/http/middleware/logging.go": "a477fda512953eb9f46266537c12ace9cc992ba8f036a5b041f9f8295bfd2097",
|
||||
"internal/transport/http/middleware/context.go": "f6db0e807659f30b05cae91f73c70d87f359760c57110e0d25b49a65bd0394a5",
|
||||
"internal/transport/http/httputils/helper.go": "a18445ba40cea946e16c07e9da0d790b31492483f482ab5ba7b2ffabc6a1fe47",
|
||||
"internal/database/repository/user.go": "0c3fc62b808a2f3af7477ac25d412b901658042c853fd7657b56d542e450ab13",
|
||||
"internal/database/repository/message.go": "16ec89107d038374d92a3e1d7f65f885164d058dc650aabeffd1b18b5c4adedd",
|
||||
"internal/database/repository/session.go": "eb789a557739cf940f8d1af9319b3f6084bb4cb7ba166f29e362e7dc27ae5ddd",
|
||||
"internal/database/repository/utils.go": "5fe7073ef5497f4d66b83382e341ade746111ea27093301740a31c6f7ae24afd",
|
||||
"internal/database/repository/chat.go": "8e5c406508e191680853223c54d86cec617317a084ea8de6c5a5eb70973721b4",
|
||||
"internal/database/repository/errors.go": "7cfb01e426127dda50abca5b98273091d5ecd27de448f40017520cf000fd4bae",
|
||||
"internal/database/sqlc/models.go": "3cabe7a22e3871e170d72698b63fabde9e1c3ae2e832be3586fa36052a2c5224",
|
||||
"internal/database/sqlc/db.go": "3ca71a7f007a39987cae838da64303419dd804d2d1b6227676f47177971d76cf",
|
||||
"internal/database/sqlc/sessions.sql.go": "3dd798158d7da2c9ac973ed98bf711620c46982c3abf93105c002a43d3b3a84e",
|
||||
"internal/database/sqlc/chats.sql.go": "3dccf4b0ffa918ec5a3b66026b3dab4027456b499486359881000d184944802c",
|
||||
"internal/database/sqlc/messages.sql.go": "224d6d8bd21426759ca6500e0eb3563564d51e639f1b6c64db4b3a43a5241c2a",
|
||||
"internal/database/sqlc/users.sql.go": "b954abd5b5964df39c20d857a60105513af84c8df68ce1ac9421da541a7800f4",
|
||||
"internal/database/sqlc/chat_members.sql.go": "9e8cd177f6f888c72d19857fd4748fbb2020770c1af772a463fe3d1b813b37ee",
|
||||
"cmd/migrate/main.go": "6e9d413a86f53cf5f2e83d5ed0308af9b2c33e69fcb3d061b19bf480e352f257",
|
||||
"cmd/api/main.go": "ec0257157d742c5007e4791b27b99432fb4a363fdd50b6df80d6b559e00040fa",
|
||||
"db/migrations/embed.go": "a42e52ab05bc89b557a5bc6b3f0215883d99c4a039a8b32d6c19e66b2f769508",
|
||||
"db/migrations/00002_add_created_at_defaults.sql": "e0680838294b93f916d727a3a20d83aca7c3f74077202c9696b1fc73cda14649",
|
||||
"db/migrations/00001_init_schema.sql": "32223afbc24f8250de055690c9e86299ebf2cd7a0d3ef2c59d3b2a5aaa41e84e",
|
||||
"db/queries/chat_members.sql": "e70940e35f325550041c290a571901ead4a6f93dece857ffa229f2f1c83eddf8",
|
||||
"db/queries/users.sql": "0d73a6d46f4d4a1b0af37b750a208c07a38249f76974b41748f32c1949f990df",
|
||||
"db/queries/messages.sql": "022c9f7aade55345f6cebd31f38084e73cb9a1419d56fa5316eaa36c9da52860",
|
||||
"db/queries/chats.sql": "8c52c762da78eb3a3eb7402b17ec87bd7fc2e1387f6ddb8e297b4f2d75beca7b",
|
||||
"db/queries/sessions.sql": "787014f9d5000bddee7f9cf32ff78091491e822afafdc8c81b3252c5c20a535b",
|
||||
"compose.yaml": "1352be71574acf2151c7f5124ac4fa1e71286da9a759467605e787d5cdf0d5eb",
|
||||
"Dockerfile": "eddd3924e99335ce0253792e85bcabb19b50d684c34073dd3b6ff958d0f7c652",
|
||||
"Dockerfile.migrate": "0ab04cba4c2bb033c4d7c7d3a5984d8a27e8f355ff90e6023c3b7912d2211dec",
|
||||
"go.mod": "f704b1f0bb9cd5692924f5d4a6a368a1b6e256b53d8cb3b87af6fb6991891a50",
|
||||
"go.sum": "f6af2acfc00713570bc0ce2152c034674fff4ab40c42bf4a22d14420741abf64"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"changes": []
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
[
|
||||
{
|
||||
"check": "teacher-check",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "teacher-openapi",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "go-all-race",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-smoke",
|
||||
"exit_code": 2,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "auth-normal",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-persistence",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "auth-dependency",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "start-expiry-api",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-expiry",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,257 @@
|
||||
{
|
||||
"date": "2026-10-13",
|
||||
"project": "highload-auth-retest-658e0bd7",
|
||||
"overall": "FAIL",
|
||||
"suites": [
|
||||
{
|
||||
"check": "teacher-check",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "teacher-openapi",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "go-all-race",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-smoke",
|
||||
"exit_code": 2,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "auth-normal",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-persistence",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "auth-dependency",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "start-expiry-api",
|
||||
"exit_code": 0,
|
||||
"status": "INVALID_SETUP",
|
||||
"detail": "Initial temporary service lacked secret mount; runtime check failed. Corrected and auth-expiry rerun passed."
|
||||
},
|
||||
{
|
||||
"check": "auth-expiry",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "corrected-expiry-api-start",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
}
|
||||
],
|
||||
"go_counts": {
|
||||
"pass": 19,
|
||||
"fail": 2,
|
||||
"skip": 0
|
||||
},
|
||||
"go_tests": [
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestConnectionSecretErrorsAreSafe"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestEmbeddedMigrationsAreVersionedAndCollectable"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestUnlockHasBudgetEvenWithDetachedContext"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestPostgresMigrationsRepeatWithoutChangingDataOrLoggingSQL"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestPostgresConcurrentMigratorsApplyEachVersionOnce"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestPostgresMigrationFailureRollsBackAndPreservesCause"
|
||||
},
|
||||
{
|
||||
"Action": "fail",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageAuthHandlerRejectsJSONBody"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestPasswordRoundTripAndRandomSalt"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestPasswordDoesNotTruncateLongUTF8"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestPasswordWhitespaceIsSignificant"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestMalformedPasswordHashRejectedWithoutPanic"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStoragePasswordIsKDFAndDuplicateCannotOverwrite"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageSessionHashAndReconnectPreserveDeadline"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageWrongCredentialsNeverCreateSession"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageRevocationIsPersistentAndSessionSpecific"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageExpiredSessionCannotRevive"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageShortTTLExpiresAndReLoginWorks"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageChatRollbackAfterMemberInsertFailure"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestMiddlewareUnavailableDatabaseStopsHandler"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestMiddlewareMalformedAuthWritesExactlyOneError"
|
||||
},
|
||||
{
|
||||
"Action": "fail",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageHTTPAuthRoutingAndLogout"
|
||||
}
|
||||
],
|
||||
"focused_diagnostics": {
|
||||
"scope": "actual sessions issued by HTTP API; alternate logout route is diagnostic only and does not satisfy contract",
|
||||
"results": [
|
||||
{
|
||||
"check": "working login and Bearer identity",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "required logout route returns 204",
|
||||
"status": "FAIL",
|
||||
"detail": "DELETE /api/v1/auth/sessions/current: expected [204], received 404"
|
||||
},
|
||||
{
|
||||
"check": "implemented alternate logout route revokes its token",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "revoked session is rejected",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "actual issued token messages and expiry survive full API/Postgres restart",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "live stays 200 during PostgreSQL outage",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "anonymous request stays 401 during outage",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "ready 503 follows Error schema",
|
||||
"status": "FAIL",
|
||||
"detail": "response: missing required fields"
|
||||
},
|
||||
{
|
||||
"check": "valid Bearer request returns 503 unavailable during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "GET /api/v1/users/me: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "registration returns 503 during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "POST /api/v1/users: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "login returns 503 during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "POST /api/v1/auth/sessions: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "logout does not succeed during outage",
|
||||
"status": "FAIL",
|
||||
"detail": "DELETE /api/v1/auth/sessions/current: expected [503], received 500"
|
||||
},
|
||||
{
|
||||
"check": "original session recovers after PostgreSQL returns",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "revoked token remains revoked after database recovery",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "restart evidence shows both processes restarted with same volume",
|
||||
"status": "PASS"
|
||||
}
|
||||
]
|
||||
},
|
||||
"protected_source_changes": [],
|
||||
"cleanup_exit": 0,
|
||||
"limits": [
|
||||
"Redis/Valkey is absent and not tested",
|
||||
"Repository scripts/restart.sh is missing; public persistence used an explicit temporary hook",
|
||||
"Old lab1 HTTP/container suites have not been adapted to lab2",
|
||||
"EXPLAIN/grade5 experiment not tested"
|
||||
],
|
||||
"invalid_setup": [
|
||||
"First expiry API setup inherited environment but not secret mount from temporary Compose override. Added test secret mount and dependency checks; expiry was rerun successfully."
|
||||
]
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import json,pathlib,subprocess,sys,time,urllib.request,urllib.error
|
||||
s=json.loads(pathlib.Path('/tmp/highload-current-auth-retest.json').read_text())
|
||||
assert s['project'].startswith('highload-auth-retest-')
|
||||
base=['docker','compose','-p',s['project'],'--project-directory',s['root'],'-f',s['root']+'/compose.yaml','-f',s['tmp']+'/compose.test.yaml']
|
||||
action=pathlib.Path(sys.argv[0]).stem.split('-')[-1]
|
||||
assert action in ('restart','failure','recovery')
|
||||
def snapshot():
|
||||
result={}
|
||||
for service in ('api','postgres'):
|
||||
p=subprocess.run(base+['ps','-aq',service],capture_output=True,text=True,check=True)
|
||||
ident=p.stdout.strip()
|
||||
raw=json.loads(subprocess.run(['docker','inspect',ident],capture_output=True,text=True,check=True).stdout)[0]
|
||||
result[service]={'id':ident,'started_at':raw['State']['StartedAt'],'running':raw['State']['Running'],'volumes':[m['Name'] for m in raw['Mounts'] if m['Type']=='volume']}
|
||||
return result
|
||||
before=snapshot()
|
||||
tail={'restart':['restart','api','postgres'],'failure':['stop','postgres'],'recovery':['start','postgres']}[action]
|
||||
p=subprocess.run(base+tail,capture_output=True,text=True,timeout=65)
|
||||
pathlib.Path(s['tmp'],action+'-hook-docker.log').write_text(p.stdout+p.stderr)
|
||||
if p.returncode:raise SystemExit(p.returncode)
|
||||
if action!='failure':
|
||||
deadline=time.monotonic()+20
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(s['base_url']+'/health/ready',timeout=3) as response:
|
||||
if response.status==200:break
|
||||
except (OSError,urllib.error.URLError):pass
|
||||
if time.monotonic()>deadline:raise SystemExit(2)
|
||||
time.sleep(.2)
|
||||
proof={'action':action,'before':before,'after':snapshot()}
|
||||
with pathlib.Path(s['tmp'],'hook-proof.jsonl').open('a') as f:f.write(json.dumps(proof)+'\n')
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import json,pathlib,subprocess,sys,time,urllib.request,urllib.error
|
||||
s=json.loads(pathlib.Path('/tmp/highload-current-auth-retest.json').read_text())
|
||||
assert s['project'].startswith('highload-auth-retest-')
|
||||
base=['docker','compose','-p',s['project'],'--project-directory',s['root'],'-f',s['root']+'/compose.yaml','-f',s['tmp']+'/compose.test.yaml']
|
||||
action=pathlib.Path(sys.argv[0]).stem.split('-')[-1]
|
||||
assert action in ('restart','failure','recovery')
|
||||
def snapshot():
|
||||
result={}
|
||||
for service in ('api','postgres'):
|
||||
p=subprocess.run(base+['ps','-aq',service],capture_output=True,text=True,check=True)
|
||||
ident=p.stdout.strip()
|
||||
raw=json.loads(subprocess.run(['docker','inspect',ident],capture_output=True,text=True,check=True).stdout)[0]
|
||||
result[service]={'id':ident,'started_at':raw['State']['StartedAt'],'running':raw['State']['Running'],'volumes':[m['Name'] for m in raw['Mounts'] if m['Type']=='volume']}
|
||||
return result
|
||||
before=snapshot()
|
||||
tail={'restart':['restart','api','postgres'],'failure':['stop','postgres'],'recovery':['start','postgres']}[action]
|
||||
p=subprocess.run(base+tail,capture_output=True,text=True,timeout=65)
|
||||
pathlib.Path(s['tmp'],action+'-hook-docker.log').write_text(p.stdout+p.stderr)
|
||||
if p.returncode:raise SystemExit(p.returncode)
|
||||
if action!='failure':
|
||||
deadline=time.monotonic()+20
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(s['base_url']+'/health/ready',timeout=3) as response:
|
||||
if response.status==200:break
|
||||
except (OSError,urllib.error.URLError):pass
|
||||
if time.monotonic()>deadline:raise SystemExit(2)
|
||||
time.sleep(.2)
|
||||
proof={'action':action,'before':before,'after':snapshot()}
|
||||
with pathlib.Path(s['tmp'],'hook-proof.jsonl').open('a') as f:f.write(json.dumps(proof)+'\n')
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import json,pathlib,subprocess,sys,time,urllib.request,urllib.error
|
||||
s=json.loads(pathlib.Path('/tmp/highload-current-auth-retest.json').read_text())
|
||||
assert s['project'].startswith('highload-auth-retest-')
|
||||
base=['docker','compose','-p',s['project'],'--project-directory',s['root'],'-f',s['root']+'/compose.yaml','-f',s['tmp']+'/compose.test.yaml']
|
||||
action=pathlib.Path(sys.argv[0]).stem.split('-')[-1]
|
||||
assert action in ('restart','failure','recovery')
|
||||
def snapshot():
|
||||
result={}
|
||||
for service in ('api','postgres'):
|
||||
p=subprocess.run(base+['ps','-aq',service],capture_output=True,text=True,check=True)
|
||||
ident=p.stdout.strip()
|
||||
raw=json.loads(subprocess.run(['docker','inspect',ident],capture_output=True,text=True,check=True).stdout)[0]
|
||||
result[service]={'id':ident,'started_at':raw['State']['StartedAt'],'running':raw['State']['Running'],'volumes':[m['Name'] for m in raw['Mounts'] if m['Type']=='volume']}
|
||||
return result
|
||||
before=snapshot()
|
||||
tail={'restart':['restart','api','postgres'],'failure':['stop','postgres'],'recovery':['start','postgres']}[action]
|
||||
p=subprocess.run(base+tail,capture_output=True,text=True,timeout=65)
|
||||
pathlib.Path(s['tmp'],action+'-hook-docker.log').write_text(p.stdout+p.stderr)
|
||||
if p.returncode:raise SystemExit(p.returncode)
|
||||
if action!='failure':
|
||||
deadline=time.monotonic()+20
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(s['base_url']+'/health/ready',timeout=3) as response:
|
||||
if response.status==200:break
|
||||
except (OSError,urllib.error.URLError):pass
|
||||
if time.monotonic()>deadline:raise SystemExit(2)
|
||||
time.sleep(.2)
|
||||
proof={'action':action,'before':before,'after':snapshot()}
|
||||
with pathlib.Path(s['tmp'],'hook-proof.jsonl').open('a') as f:f.write(json.dumps(proof)+'\n')
|
||||
Reference in New Issue
Block a user