forked from mtusi2026/mtusi2026lab2
ЛР 2: закрыть уровень 4
Завершить PostgreSQL, Redis-сессии, миграции, таймауты и диагностику. Зафиксировать собственные тесты и доказательства финального прогона: 43 PASS, 0 FAIL, 0 SKIP; 768 HTTP-запросов без ошибок. Добавить официальный отчёт с запуском, архитектурой, SQL-планами и ограничениями. PR отложен до завершения уровня 5.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
# Повторный прогон тестов — 14.10.2026
|
||||
|
||||
Итог: **FAIL для полного набора собственных проверок**.
|
||||
Все 21 Go-тест с race detector прошли без пропусков. Публичные smoke и
|
||||
persistence прошли. Обычные HTTP auth-проверки: 15 PASS, 1 FAIL.
|
||||
Код приложения, тесты и обязательный контракт этим прогоном не менялись.
|
||||
|
||||
## Что ещё не проходит
|
||||
|
||||
1. **Проверка тела выполняется до проверки Basic.**
|
||||
В internal/transport/http/handler/auth.go:25 стоит io.ReadFull; проверка
|
||||
r.BasicAuth начинается на строке 34. Поэтому JSON без Authorization получает
|
||||
400 invalid_request, а HTTP-тест ожидает 401 unauthorized и Basic challenge.
|
||||
Это TestLogin test_login_does_not_accept_json_credentials, первый запрос.
|
||||
Основание ожидания: contracts/README.md задаёт 401 при отсутствии действительной
|
||||
идентификации и Basic для входа; OpenAPI объявляет basicAuth security.
|
||||
Тест применяет приоритет аутентификации перед проверкой payload.
|
||||
Запрет JSON с корректным Basic уже работает: компонентный Go-тест проверил
|
||||
400 и отсутствие новой записи sessions. Этот прежний дефект исправлен.
|
||||
|
||||
2. **При остановке PostgreSQL бизнес-запросы получают 500 вместо 503.**
|
||||
Независимые HTTP-проверки воспроизвели 500 для GET /api/v1/users/me с действующим
|
||||
токеном, POST /api/v1/users, POST /api/v1/auth/sessions и DELETE
|
||||
/api/v1/auth/sessions/current. Общая dependency suite также получила 500
|
||||
с неизвестным Bearer. Требуется 503 unavailable для отказа зависимости.
|
||||
Обработка net.OpError/ECONNREFUSED в Go-тесте проходит, но фактический сценарий
|
||||
остановки БД полностью не покрыт классификацией ошибок. Проверять цепочку
|
||||
convertDBError → convertRepoError → ErrorFromService. Низкоуровневый тип
|
||||
каждой ошибки бизнес-запроса отдельно не снимался; точный HTTP-результат
|
||||
подтверждён. После восстановления PostgreSQL прежняя сессия снова работает.
|
||||
|
||||
## Результаты
|
||||
|
||||
| Проверка | Результат |
|
||||
| --- | --- |
|
||||
| Сборка текущих API/migrate и Compose config | PASS |
|
||||
| make check | PASS, структура/контракт |
|
||||
| make validate | PASS, OpenAPI 3.1/JSON Schema |
|
||||
| go test -race ./... -count=1 -json с PostgreSQL | 21 PASS, 0 FAIL, 0 SKIP |
|
||||
| Публичный make test | PASS |
|
||||
| Обычный HTTP auth suite | 15 PASS, 1 FAIL: приоритет Basic/body |
|
||||
| Публичный make test-persistence | PASS |
|
||||
| HTTP auth persistence: исходный/отозванный токены после рестарта | PASS |
|
||||
| HTTP expiry, отдельный API с TTL=2 | PASS |
|
||||
| HTTP dependency/PostgreSQL | FAIL: 500 вместо 503 |
|
||||
| Дополнительный реальный рестарт | PASS: исходный токен, сообщения и expires_at сохранены |
|
||||
| Logout по обязательному пути, повторный logout | PASS: 204, затем 401 |
|
||||
| Readiness с остановленной БД | PASS: 503, Error JSON, unavailable, request_id |
|
||||
| Liveness и запрос без авторизации при остановленной БД | PASS: 200 и 401 |
|
||||
| Возврат БД и сохранение отзыва | PASS |
|
||||
| Очистка только временного стенда | PASS, exit 0 |
|
||||
|
||||
Относительно предыдущего отчёта исправлены обязательный путь logout,
|
||||
формат readiness и создание сессии при запрещённом JSON body с корректным
|
||||
Basic. В проверке тела остался вопрос порядка обработки отсутствующего Basic.
|
||||
|
||||
## Стенд и доказательства
|
||||
|
||||
Docker сначала был выключен; запущен Docker Desktop. Временное Python-окружение
|
||||
с requirements-dev.txt восстановлено в /tmp, зависимости проекта не менялись.
|
||||
Новый проект highload-auth-retest-76b890c3 использовал отдельный новый volume,
|
||||
фиксированные тестовые localhost-порты и новые синтетические secrets.
|
||||
Образы собраны из текущих исходников. Основной API — TTL 3600; отдельный процесс
|
||||
того же образа — TTL 2. Все сессии получены через реальный HTTP login.
|
||||
|
||||
Restart/failure/recovery hooks действовали только на этот проект. В
|
||||
hook-proof.jsonl сохранены started_at обоих сервисов до и после и неизменное
|
||||
имя PostgreSQL volume. При перезапусках volume не удалялся. После всех проверок
|
||||
временные API, API expiry, PostgreSQL, сеть и собственный volume удалены;
|
||||
рабочие volumes не использовались. Docker Desktop оставлен работающим.
|
||||
|
||||
Исходники internal/, cmd/, db/, contracts/, tests/, scripts/, Compose, Dockerfiles,
|
||||
go.mod/go.sum и основные документы проверены по хешам: изменений во время
|
||||
прогона нет. Assertions не ослаблялись. Обновлены только эта evidence и статус
|
||||
в student-tests/AUTH_TESTS.md.
|
||||
|
||||
14.10.2026 заново загружен master репозитория
|
||||
[преподавателя](https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2).
|
||||
18 обязательных документов, файлов contracts/tests/scripts сравнены побайтово:
|
||||
различий нет. Результат сохранён в teacher-comparison.json.
|
||||
|
||||
Доказательства: summary.json, go-all-race.log, teacher-smoke.log, auth-normal.log,
|
||||
teacher-persistence.log, auth-persistence.log, auth-expiry.log,
|
||||
auth-dependency.log, focused-diagnostics.json, readiness-outage-shape.json,
|
||||
hook-proof.jsonl, images.json, source-verification.json, cleanup.log.
|
||||
Пароли и токены в evidence не сохранялись; синтетический пароль вычищен из
|
||||
копии инфраструктурных логов, секретные файлы не копировались.
|
||||
|
||||
## Границы результата
|
||||
|
||||
scripts/restart.sh в репозитории ещё отсутствует. Persistence прошёл с явными
|
||||
временными hooks; для воспроизводимой сдачи нужен собственный hook.
|
||||
Redis/Valkey пока не добавлен и не проверялся. EXPLAIN >=10k и эксперимент на 5
|
||||
не запускались. Старые HTTP/container suites lab1 не адаптированы к lab2.
|
||||
Прохождение перечисленных сценариев не означает отсутствие всех ошибок
|
||||
или полную готовность лабораторной на 4/5.
|
||||
@@ -0,0 +1,39 @@
|
||||
services:
|
||||
api:
|
||||
image: highload-auth-retest-76b890c3-api:latest
|
||||
ports: !override
|
||||
- "127.0.0.1:56933: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:56934:5432"
|
||||
api_expiry:
|
||||
extends:
|
||||
service: api
|
||||
image: highload-auth-retest-76b890c3-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:56935:8080"
|
||||
environment:
|
||||
SESSION_TTL_SECONDS: "2"
|
||||
secrets:
|
||||
database_url:
|
||||
file: /tmp/highload-auth-retest-76b890c3/database_url
|
||||
postgres_password:
|
||||
file: /tmp/highload-auth-retest-76b890c3/postgres_password
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"scope": "actual sessions issued by HTTP API; contract logout route; isolated project only",
|
||||
"results": [
|
||||
{
|
||||
"check": "working login and Bearer identity",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "required logout route returns 204",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "repeat logout with revoked token returns 401",
|
||||
"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": "PASS"
|
||||
},
|
||||
{
|
||||
"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))
|
||||
# Repeating logout with the revoked token must return 401.
|
||||
record('repeat logout with revoked token returns 401',lambda:c.call('DELETE','/api/v1/auth/sessions/current',401,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; contract logout route; isolated project only','results':results},indent=2))
|
||||
raise SystemExit(0 if all(x['status']=='PASS' for x in results) else 1)
|
||||
@@ -0,0 +1 @@
|
||||
{"exit_code": 1}
|
||||
@@ -0,0 +1,7 @@
|
||||
{"action": "restart", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:51:11.295643011Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:51:04.948181091Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:33.041280715Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:32.44812134Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "restart", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:33.041280715Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:32.44812134Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:34.535985716Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "failure", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:34.535985716Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:34.535985716Z", "running": false, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "recovery", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:34.535985716Z", "running": false, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:37.569955842Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "restart", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:52:34.692137924Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:52:37.569955842Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:53:09.85648951Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:53:09.687405718Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "failure", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:53:09.85648951Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:53:09.687405718Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:53:09.85648951Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:53:09.687405718Z", "running": false, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
{"action": "recovery", "before": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:53:09.85648951Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:53:09.687405718Z", "running": false, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}, "after": {"api": {"id": "89e6c93aafdc799b7dfe3a5dd770355156e35d99b88232680e7e2b694c046ba8", "started_at": "2026-10-14T12:53:09.85648951Z", "running": true, "volumes": []}, "postgres": {"id": "12eaa64c6587f49701ec8861f2fa6f179f47cd21d7155463a0ad6e95383d78b5", "started_at": "2026-10-14T12:53:11.722964969Z", "running": true, "volumes": ["highload-auth-retest-76b890c3_postgres_data"]}}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"api": "sha256:dc805ddcf9de57650e06a08d2fdf305e48d0c43d6088bad778506f9a4c9e5137",
|
||||
"migrate": "sha256:b135e311d635714e0928d2f05ed04eda93017053e28133d54727d2ab0e569776",
|
||||
"postgres": "sha256:5a5a84b19854a9ffaa54082c166ff4ec27473a361e496e5ea167f298f2da9722",
|
||||
"api_expiry": "sha256:dc805ddcf9de57650e06a08d2fdf305e48d0c43d6088bad778506f9a4c9e5137"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"status": 503,
|
||||
"body": {
|
||||
"error": {
|
||||
"code": "unavailable",
|
||||
"message": "unavailable",
|
||||
"request_id": "cc09cddf-1f26-447f-9cc0-5367ea8bde74"
|
||||
}
|
||||
},
|
||||
"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 @@
|
||||
{"exit_code": 0}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"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": "c452f3d9e9781cdfd45212f901ce286b285f566ade65048a985ea0cdae7c67e4",
|
||||
"internal/transport/http/handler/chat_types.go": "d181bce0f003749d813c1254df4c8ebcc1b99ff506b61efa6899da4a499e95f4",
|
||||
"internal/transport/http/handler/user.go": "86fd65ed176e9a83dc27c1112ff8384bc5aa32a92410290fb505d715ca167775",
|
||||
"internal/transport/http/handler/auth.go": "a0f96ba71fbce27cc0669d40aaae63e78ed46e854aa99b43e1880ee203c08b65",
|
||||
"internal/transport/http/handler/message.go": "43dfcabbd24fe809e407958fed34bf567bdc6dd45c61f06c2e6d6bdd3d68b3ed",
|
||||
"internal/transport/http/handler/health.go": "e8909f3c179558d4855a480536bb756cb11e5faa90e69777ec04ba63de94296c",
|
||||
"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/postgres_test.go": "04c0a327b427c0d8729fc9e5013c85c6865290e905aa306e2ac737e7cad4782a",
|
||||
"cmd/migrate/main.go": "6e9d413a86f53cf5f2e83d5ed0308af9b2c33e69fcb3d061b19bf480e352f257",
|
||||
"cmd/migrate/main_test.go": "a88f2252d70caf644904331182dc3afd4df48b825a0329a82482798ec90b5d46",
|
||||
"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",
|
||||
"contracts/examples.json": "0a71cec72903af556df85f939c7e347fc73a86a1a4ffc39fb9c8ded169b7df45",
|
||||
"contracts/README.md": "72df27a559f88ffa3fd8c3c79d3c32f6db2c5986a0602677c51994c434a3fc4f",
|
||||
"contracts/openapi.json": "cff3aa6b34855b573401b0ac393fdfe327b6a12da51f315fbbd67168ce3762c4",
|
||||
"contracts/infrastructure.json": "7efd8b1e6023ddc3ff9747d4f663ee772c1293b782bb9e74bd1c3fbcca9c68d8",
|
||||
"tests/client.py": "8d50976fc7c7bbb81e88a152f613c61ab25eaf53dba33c6a9dfab19f868d546d",
|
||||
"tests/README.md": "e0bfa7e196797f6a5bf6e44d8ad2ffeb82651927ff5d8484eb1c2dda1ec7dec5",
|
||||
"tests/load.py": "6d3511ea719c7a7e841083e73d435c86dcbfd9f4e5c2a07d62eb9614b01d9933",
|
||||
"tests/resilience.py": "1f96663a174b3978d24eff66f2741f5f8c9b788d3242261d37a972720c52788b",
|
||||
"tests/smoke.py": "52ac38eb343ff7d43e7543588e1da58ca06c9fce74b2b0d0bf0e4982bc23c1db",
|
||||
"scripts/check_contract.py": "7c4402c2a6ab80d3b4676e1866d6ecc87b6daea14c080bcb9be9a7e8b959d671",
|
||||
"scripts/validate_openapi.py": "4e981acbfc10dac58817bf922d5896e996798551fedc1b2385130e1cddb13d54",
|
||||
"scripts/restart.example.sh": "0328246ba75defbced992104e986fde973f63e3830d83251eced5953263e944b",
|
||||
"compose.yaml": "1352be71574acf2151c7f5124ac4fa1e71286da9a759467605e787d5cdf0d5eb",
|
||||
"Dockerfile": "eddd3924e99335ce0253792e85bcabb19b50d684c34073dd3b6ff958d0f7c652",
|
||||
"Dockerfile.migrate": "0ab04cba4c2bb033c4d7c7d3a5984d8a27e8f355ff90e6023c3b7912d2211dec",
|
||||
"go.mod": "f704b1f0bb9cd5692924f5d4a6a368a1b6e256b53d8cb3b87af6fb6991891a50",
|
||||
"go.sum": "f6af2acfc00713570bc0ce2152c034674fff4ab40c42bf4a22d14420741abf64",
|
||||
"README.md": "4f14a97911bd3ea335868d37fec187d1738b42f91a7d4780d33b721edf25b6dc",
|
||||
"COURSE.md": "c34d53cd082d194aa4b58f504c4e0348d25b6afec3d6a9c0963dd01c9c81e971",
|
||||
"Makefile": "668b2449e19b364092611561a28ca2cc83b6c8b35fde1c52ecfd2072795e6ca0",
|
||||
"lab.json": "d63eac8df585a63153cff0c632e6b81b2088316b53d531eecc856ec1da7855e4"
|
||||
}
|
||||
@@ -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": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "teacher-smoke",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-normal",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"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-14",
|
||||
"project": "highload-auth-retest-76b890c3",
|
||||
"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": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "teacher-smoke",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-normal",
|
||||
"exit_code": 1,
|
||||
"status": "FAIL"
|
||||
},
|
||||
{
|
||||
"check": "teacher-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "auth-persistence",
|
||||
"exit_code": 0,
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"go_counts": {
|
||||
"pass": 21,
|
||||
"fail": 0,
|
||||
"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/student-tests/auth_tests",
|
||||
"Test": "TestStorageAuthHandlerRejectsJSONBody"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestPostgresConcurrentMigratorsApplyEachVersionOnce"
|
||||
},
|
||||
{
|
||||
"Action": "pass",
|
||||
"Package": "highload/cmd/migrate",
|
||||
"Test": "TestPostgresMigrationFailureRollsBackAndPreservesCause"
|
||||
},
|
||||
{
|
||||
"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": "pass",
|
||||
"Package": "highload/student-tests/auth_tests",
|
||||
"Test": "TestStorageHTTPAuthRoutingAndLogout"
|
||||
}
|
||||
],
|
||||
"http_normal_counts": {
|
||||
"pass": 15,
|
||||
"fail": 1
|
||||
},
|
||||
"focused_diagnostics": {
|
||||
"scope": "actual sessions issued by HTTP API; contract logout route; isolated project only",
|
||||
"results": [
|
||||
{
|
||||
"check": "working login and Bearer identity",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "required logout route returns 204",
|
||||
"status": "PASS"
|
||||
},
|
||||
{
|
||||
"check": "repeat logout with revoked token returns 401",
|
||||
"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": "PASS"
|
||||
},
|
||||
{
|
||||
"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": [],
|
||||
"teacher_comparison": {
|
||||
"checked": 18,
|
||||
"differences": [],
|
||||
"status": "PASS",
|
||||
"source": "https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2",
|
||||
"date": "2026-10-14"
|
||||
},
|
||||
"cleanup_exit": 0,
|
||||
"limits": [
|
||||
"Redis/Valkey absent, not tested",
|
||||
"Public and custom persistence used temporary explicit hooks; scripts/restart.sh remains absent",
|
||||
"Old lab1 HTTP/container suites are not adapted to lab2",
|
||||
"EXPLAIN/grade5 experiment not part of this run"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"checked": 18,
|
||||
"differences": [],
|
||||
"status": "PASS",
|
||||
"source": "https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2",
|
||||
"date": "2026-10-14"
|
||||
}
|
||||
+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