Добавить результаты проверки из чистого clone и итоговый отчёт

This commit is contained in:
2026-11-01 17:19:21 +03:00
parent 8846b0554e
commit 598f076048
10 changed files with 396 additions and 0 deletions
+5
View File
@@ -4,6 +4,7 @@
- Целевая оценка: **4**, весь минимум уровня 3 и все пункты уровня 4. Треки на 5 не выполнялись.
- Проверка: 1 ноября 2026 года, Europe/Moscow. В JSON используется UTC.
- Ветка: `solution/bpi-2304-salamatin`. Основа задания — commit `0ab3a34` репозитория `mtusi2026/mtusi2026lab3`.
- Сборка и обязательные проверки повторены из отдельного локального clone; проверенный commit `8846b05` записан в `evidence/clean-source.json`. Публикация fork/PR отдельно от локальной проверки.
- Перенесена собственная lab2 из [gwalut/mtusi2026lab2](https://gitea.privcloud.tech/gwalut/mtusi2026lab2), ветка `solution/bpi-2304-salamatin`. README задания, COURSE, contracts и публичные tests lab3 сохранены.
## Запуск
@@ -82,6 +83,8 @@ Readiness API требует обе зависимости. HAProxy провер
| Ресурсные лимиты и одна точка входа | Inspect всех runtime-контейнеров | CPU/RAM ограничены; опубликован только LB; API non-root | `verification.json` |
| Поочерёдная замена под нагрузкой | Drain → stop/remove → recreate, отдельно для каждой API | Два новых контейнера; 0 HTTP-ошибок; все 4475 подтверждений сохранены | `rolling-update.json` |
| Прежние проверки уровня 4 lab2 | 12 интеграционных тестов, TTL=2, EXPLAIN | PASS; 401 через 2.3 s; индекс на 10 000 сообщениях | `student-tests.txt`, `expiry.json`, `explain.txt` |
| Воспроизводимость из чистого clone | Независимые secrets, Compose-проект и первоначально пустые volumes, повтор обязательных проверок | PASS; исходники не изменены; отдельный порт 18083 | `clean-source.json`, `clean-verification.json`, `clean-build.txt`, `clean-student-tests.txt` |
| Сохранность контракта задания | Сравнение с исходным commit, SHA-256 после нормализации EOL | 15 файлов задания/контракта/публичных проверок без изменений | `source-integrity.json` |
## Измерения
@@ -99,6 +102,8 @@ Readiness API требует обе зависимости. HAProxy провер
Краткие ошибки при резкой остановке допустимы: HAProxy ещё обнаруживает отказ. Они включены в счётчики, потерянных подтверждений и дублей не обнаружено. При управляемой замене backend сначала переводится в drain; в выполненном опыте ошибок не было. Поле `first_write_after_action_seconds` отсчитывается от начала действия до первой записи после завершения действия; для rolling оно включает длительность всей замены и **не означает 23.5 секунды простоя**.
В отдельном clone повторены сборка, публичный API, 12 тестов, полный restart, публичный failover, expiry и SQL-план. Нагрузочные опыты там не повторялись. Вспомогательный запуск TTL-контейнера один раз завис в Compose Desktop: скрипт теперь после таймаута проверяет точное имя, метки проекта/сервиса, TTL и состояние запущенного контейнера, затем всё равно выполняет HTTP-проверку истечения сессии. Итоговый повтор завершился PASS. Проверочный стенд остановлен без удаления volumes.
Это одиночные функциональные опыты, не исследование максимальной производительности. Первые 4 s нагрузки служат коротким прогревом и входят в общий RPS. Percentile рассчитаны только для успешных HTTP-операций; closed-loop ограничен клиентом и не показывает реальную очередь при фиксированной входящей интенсивности. Профиль и лимиты одинаковы для двух отказов. Сырые агрегаты, двухсекундные интервалы нагрузки, ошибки, состояния контейнеров и выборки CPU/RAM находятся в соответствующих JSON.
## Ограничения
+178
View File
@@ -0,0 +1,178 @@
#1 [internal] load local bake definitions
#1 reading from stdin 1.62kB 0.1s done
#1 DONE 0.1s
#2 [checks internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 1.23kB 0.0s done
#2 DONE 0.2s
#3 [api internal] load metadata for docker.io/library/python:3.13.15-slim-bookworm
#3 DONE 1.7s
#4 [api internal] load .dockerignore
#4 transferring context: 164B done
#4 DONE 0.0s
#5 [api runtime 1/7] FROM docker.io/library/python:3.13.15-slim-bookworm@sha256:2325bb286ec344af3e5898cc224b5844e2707ac6e26b1632516fd3edc84a5e26
#5 resolve docker.io/library/python:3.13.15-slim-bookworm@sha256:2325bb286ec344af3e5898cc224b5844e2707ac6e26b1632516fd3edc84a5e26 0.0s done
#5 DONE 0.0s
#6 [api internal] load build context
#6 transferring context: 127.23kB 0.0s done
#6 DONE 0.1s
#7 [checks internal] load metadata for docker.io/library/docker:28.5.1-cli
#7 ...
#8 [api runtime 2/7] WORKDIR /app
#8 CACHED
#9 [api runtime 3/7] COPY requirements.txt .
#9 CACHED
#10 [api runtime 4/7] RUN pip install --no-cache-dir -r requirements.txt && useradd --uid 10001 --create-home messenger
#10 CACHED
#11 [api runtime 5/7] COPY app ./app
#11 DONE 0.0s
#12 [api runtime 6/7] COPY migrations ./migrations
#12 DONE 0.0s
#13 [api runtime 7/7] COPY contracts/openapi.json ./contracts/openapi.json
#13 DONE 0.0s
#7 [checks internal] load metadata for docker.io/library/docker:28.5.1-cli
#7 DONE 2.1s
#14 [api] exporting to image
#14 exporting layers
#14 ...
#4 [checks internal] load .dockerignore
#4 transferring context: 164B done
#4 DONE 0.0s
#5 [checks runtime 1/7] FROM docker.io/library/python:3.13.15-slim-bookworm@sha256:2325bb286ec344af3e5898cc224b5844e2707ac6e26b1632516fd3edc84a5e26
#5 resolve docker.io/library/python:3.13.15-slim-bookworm@sha256:2325bb286ec344af3e5898cc224b5844e2707ac6e26b1632516fd3edc84a5e26 0.0s done
#5 DONE 0.0s
#6 [checks internal] load build context
#6 transferring context: 127.23kB 0.0s done
#6 DONE 0.1s
#8 [checks runtime 2/7] WORKDIR /app
#8 CACHED
#9 [checks runtime 3/7] COPY requirements.txt .
#9 CACHED
#10 [checks runtime 4/7] RUN pip install --no-cache-dir -r requirements.txt && useradd --uid 10001 --create-home messenger
#10 CACHED
#11 [checks runtime 5/7] COPY app ./app
#11 DONE 0.0s
#12 [checks runtime 6/7] COPY migrations ./migrations
#12 DONE 0.0s
#13 [checks runtime 7/7] COPY contracts/openapi.json ./contracts/openapi.json
#13 DONE 0.0s
#15 [checks docker_cli 1/1] FROM docker.io/library/docker:28.5.1-cli@sha256:9190b0613792e658a7783cf14b2d5ace5941bb68ede7276922ea36ee457d76ad
#15 resolve docker.io/library/docker:28.5.1-cli@sha256:9190b0613792e658a7783cf14b2d5ace5941bb68ede7276922ea36ee457d76ad 0.1s done
#15 CACHED
#14 [api] exporting to image
#14 exporting layers 0.2s done
#14 exporting manifest sha256:c6796352972df019e149e264fd4f10f4f911bfc307efaf9bad22063b91649720 0.0s done
#14 exporting config sha256:686f5574b9dc81e841a2e51babe69eb3f603a19727ecf4a7e86b6308c92cd1c9 0.0s done
#14 exporting attestation manifest sha256:b5c061d83ee4621420b884bdc878fb53ef8aaf80b79d3c239412f3a173962834 0.0s done
#14 exporting manifest list sha256:44d6a1194305d119df0968419774603e3f91231ec2e18e9ef96c596bece1aa45
#14 exporting manifest list sha256:44d6a1194305d119df0968419774603e3f91231ec2e18e9ef96c596bece1aa45 0.0s done
#14 naming to docker.io/library/mtusi-messenger:lab3 done
#14 unpacking to docker.io/library/mtusi-messenger:lab3 0.1s done
#14 DONE 0.5s
#16 [checks checks 1/4] COPY --from=docker_cli /usr/local/bin/docker /usr/local/bin/docker
#16 DONE 0.2s
#17 [checks checks 2/4] COPY --from=docker_cli /usr/local/libexec/docker/cli-plugins/docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
#17 ...
#18 [api] resolving provenance for metadata file
#18 DONE 0.0s
#17 [checks checks 2/4] COPY --from=docker_cli /usr/local/libexec/docker/cli-plugins/docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
#17 DONE 0.5s
#19 [checks checks 3/4] RUN apt-get update && apt-get install -y --no-install-recommends make && rm -rf /var/lib/apt/lists/*
#19 0.888 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#19 1.019 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
#19 1.091 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [34.8 kB]
#19 2.037 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8790 kB]
#19 2.411 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6924 B]
#19 2.486 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [360 kB]
#19 3.099 Fetched 9398 kB in 3s (3494 kB/s)
#19 3.099 Reading package lists...
#19 3.619 Reading package lists...
#19 4.150 Building dependency tree...
#19 4.303 Reading state information...
#19 4.528 Suggested packages:
#19 4.528 make-doc
#19 4.564 The following NEW packages will be installed:
#19 4.564 make
#19 5.003 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
#19 5.003 Need to get 396 kB of archives.
#19 5.003 After this operation, 1630 kB of additional disk space will be used.
#19 5.003 Get:1 http://deb.debian.org/debian bookworm/main amd64 make amd64 4.3-4.1 [396 kB]
#19 5.144 debconf: delaying package configuration, since apt-utils is not installed
#19 5.187 Fetched 396 kB in 0s (903 kB/s)
#19 5.216 Selecting previously unselected package make.
#19 5.216 (Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 6647 files and directories currently installed.)
#19 5.228 Preparing to unpack .../make_4.3-4.1_amd64.deb ...
#19 5.232 Unpacking make (4.3-4.1) ...
#19 5.313 Setting up make (4.3-4.1) ...
#19 DONE 5.4s
#20 [checks checks 4/4] WORKDIR /checks
#20 DONE 0.0s
#21 [checks] exporting to image
#21 exporting layers
#21 exporting layers 2.6s done
#21 exporting manifest sha256:332603107937ddb6d09120706d8a89a7982afc1d22fb7d21c1032df72e821bad 0.0s done
#21 exporting config sha256:9e72a1e40219ba7d76c7f611b9b6515c3951f1d11fe17d8667a957653055f756 0.0s done
#21 exporting attestation manifest sha256:45c5c8e67c55dc9079da17e98a55fcab163094e19b96d649835d4a7dcf94660f 0.0s done
#21 exporting manifest list sha256:9d3dabaddbcc018197642500815a803e9b73a78457de7bcf913a51ce4361ce94 0.0s done
#21 naming to docker.io/library/mtusi-messenger:lab3-checks done
#21 unpacking to docker.io/library/mtusi-messenger:lab3-checks
#21 unpacking to docker.io/library/mtusi-messenger:lab3-checks 0.7s done
#21 DONE 3.5s
#22 [checks] resolving provenance for metadata file
#22 DONE 0.0s
mtusi-messenger:lab3 Built
mtusi-messenger:lab3-checks Built
+7
View File
@@ -0,0 +1,7 @@
{
"session_ttl_seconds": 2,
"wait_seconds": 2.3,
"before_expiry_status": 200,
"after_expiry_status": 401,
"result": "PASS"
}
+29
View File
@@ -0,0 +1,29 @@
FIRST
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..6.27 rows=51 width=72) (actual time=0.021..0.031 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..1173.00 rows=10000 width=72) (actual time=0.020..0.027 rows=51 loops=1)
Index Cond: (chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid)
Buffers: shared hit=5
Planning Time: 0.106 ms
Execution Time: 0.049 ms
MIDDLE
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s AND (created_at, id) > (%s, %s) ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..8.78 rows=51 width=72) (actual time=0.020..0.028 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..796.60 rows=4782 width=72) (actual time=0.019..0.024 rows=51 loops=1)
Index Cond: ((chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 14:17:09.314636+00'::timestamp with time zone, '179a43c3-4807-4a81-9699-e48b56f1a4de'::uuid)))
Buffers: shared hit=3
Planning Time: 0.100 ms
Execution Time: 0.044 ms
LATE
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s AND (created_at, id) > (%s, %s) ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..113.51 rows=51 width=72) (actual time=0.023..0.037 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..211.19 rows=95 width=72) (actual time=0.021..0.032 rows=51 loops=1)
Index Cond: ((chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 14:17:09.319536+00'::timestamp with time zone, '5e558383-5ef2-4321-805a-a4484cfd2f27'::uuid)))
Buffers: shared hit=5
Planning Time: 0.099 ms
Execution Time: 0.053 ms
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 98, "failed_attempts": 4, "first_recovery_seconds": 3.306}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://lb:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+19
View File
@@ -0,0 +1,19 @@
{
"source_commit": "8846b0554e9dc1cf53184249f649181870d1f4f5",
"method": "git clone --no-local; independent secrets, project and volumes; initial empty-volume bootstrap, then verification replay",
"source_files_unchanged": true,
"independent_secrets": true,
"compose_project": "mtusi-lab3-clean",
"port": 18083,
"result": "PASS",
"checks": [
"public_smoke",
"student_tests",
"full_restart",
"public_failover",
"expiry",
"index_10000",
"published_smoke"
],
"load_experiments": "Performed on primary project; not repeated in clean project"
}
+29
View File
@@ -0,0 +1,29 @@
Container mtusi-lab3-clean-redis-1 Running
Container mtusi-lab3-clean-postgres-1 Running
Container mtusi-lab3-clean-api-1 Running
Container mtusi-lab3-clean-api-2 Running
Container mtusi-lab3-clean-lb-1 Running
Container mtusi-lab3-clean-postgres-1 Waiting
Container mtusi-lab3-clean-postgres-1 Healthy
Container mtusi-lab3-clean-migrate-1 Starting
Container mtusi-lab3-clean-migrate-1 Started
Container mtusi-lab3-clean-migrate-1 Waiting
Container mtusi-lab3-clean-redis-1 Waiting
Container mtusi-lab3-clean-redis-1 Healthy
Container mtusi-lab3-clean-migrate-1 Exited
Container mtusi-lab3-clean-api-1 Waiting
Container mtusi-lab3-clean-api-2 Waiting
Container mtusi-lab3-clean-api-1 Healthy
Container mtusi-lab3-clean-api-2 Healthy
Container mtusi-lab3-clean-api-1 Waiting
Container mtusi-lab3-clean-api-2 Waiting
Container mtusi-lab3-clean-lb-1 Waiting
Container mtusi-lab3-clean-postgres-1 Waiting
Container mtusi-lab3-clean-redis-1 Waiting
Container mtusi-lab3-clean-migrate-1 Waiting
Container mtusi-lab3-clean-postgres-1 Healthy
Container mtusi-lab3-clean-lb-1 Healthy
Container mtusi-lab3-clean-redis-1 Healthy
Container mtusi-lab3-clean-migrate-1 Exited
Container mtusi-lab3-clean-api-1 Healthy
Container mtusi-lab3-clean-api-2 Healthy
+23
View File
@@ -0,0 +1,23 @@
python3 -m unittest discover -s student-tests -v
ROLLBACK: invalid second member left no chat or membership rows
CONCURRENCY: 10 clients, 100 confirmations, 100 unique messages
FAILURES: Redis/PostgreSQL -> bounded 503, live 200, anonymous 401, recovery with old session
REDIS CRASH: old session survived SIGKILL/AOF replay, expiry deadline unchanged
RACE: 10 requests, 1 created, 9 conflicts, 1 database row
test_composite_chat_rollback (test_api.APITests.test_composite_chat_rollback) ... ok
test_concurrent_messages (test_api.APITests.test_concurrent_messages) ... ok
test_cursor_binding_and_chat_pages (test_api.APITests.test_cursor_binding_and_chat_pages) ... ok
test_dependency_failures (test_api.APITests.test_dependency_failures) ... ok
test_passwords_and_authentication (test_api.APITests.test_passwords_and_authentication) ... ok
test_redis_crash_durability (test_api.APITests.test_redis_crash_durability) ... ok
test_registration_race (test_api.APITests.test_registration_race) ... ok
test_validation_and_access (test_api.APITests.test_validation_and_access) ... ok
test_expired_key_and_same_session_on_all_instances (test_replication.ReplicationTests.test_expired_key_and_same_session_on_all_instances) ... ok
test_failed_transaction_does_not_save_message_or_replay (test_replication.ReplicationTests.test_failed_transaction_does_not_save_message_or_replay) ... ok
test_key_validation_scope_conflict_and_logout (test_replication.ReplicationTests.test_key_validation_scope_conflict_and_logout) ... ok
test_parallel_replay_across_real_replicas (test_replication.ReplicationTests.test_parallel_replay_across_real_replicas) ... ok
----------------------------------------------------------------------
Ran 12 tests in 20.059s
OK
+99
View File
@@ -0,0 +1,99 @@
{
"result": "PASS",
"utc": "2026-11-01T14:17:19.209238+00:00",
"base_url": "http://127.0.0.1:18083",
"checks": [
"public_smoke",
"student_tests",
"full_restart",
"public_failover",
"expiry",
"index_10000",
"published_smoke"
],
"docker": {
"ServerVersion": "28.5.1",
"OperatingSystem": "Docker Desktop",
"Architecture": "x86_64",
"NCPU": 16,
"MemTotal": 8017608704
},
"deployment": [
{
"service": "api",
"id": "fdb00a8942f77a6932ab14eff5e95288c042758910b4eff7cbbfebc5ae199113",
"name": "mtusi-lab3-clean-api-1",
"started_at": "2026-11-01T14:16:55.793576274Z",
"status": "running",
"image": "sha256:44d6a1194305d119df0968419774603e3f91231ec2e18e9ef96c596bece1aa45",
"user": "messenger",
"memory_bytes": 268435456,
"nano_cpus": 1000000000,
"published_ports": {},
"volumes": []
},
{
"service": "api",
"id": "c895ff671b9702dacc8d679b813bd4d9909c728c0693e1b74c34457620a9eea8",
"name": "mtusi-lab3-clean-api-2",
"started_at": "2026-11-01T14:16:27.4130602Z",
"status": "running",
"image": "sha256:44d6a1194305d119df0968419774603e3f91231ec2e18e9ef96c596bece1aa45",
"user": "messenger",
"memory_bytes": 268435456,
"nano_cpus": 1000000000,
"published_ports": {},
"volumes": []
},
{
"service": "postgres",
"id": "813ea46232aa5c266f08e75be2ac1af75938614e8c7e54406aa8bf43791c4f52",
"name": "mtusi-lab3-clean-postgres-1",
"started_at": "2026-11-01T14:16:26.066303846Z",
"status": "running",
"image": "sha256:f3bd19c606e442c3d7bdfa8002e03fe260a1023351e0ea4598032022b68dd6e3",
"user": "",
"memory_bytes": 536870912,
"nano_cpus": 1000000000,
"published_ports": {},
"volumes": [
"mtusi-lab3-clean_postgres_data"
]
},
{
"service": "redis",
"id": "7e7a58f080e9cbae36351d308c855ccbbddf44d2cb5694ec496c8d46345f4824",
"name": "mtusi-lab3-clean-redis-1",
"started_at": "2026-11-01T14:16:25.938214158Z",
"status": "running",
"image": "sha256:90e7a336d044f1abc9e9dbc05d65566850896d11453bbd1dd0fb7e5059f0e8fb",
"user": "",
"memory_bytes": 201326592,
"nano_cpus": 500000000,
"published_ports": {},
"volumes": [
"mtusi-lab3-clean_redis_data"
]
},
{
"service": "lb",
"id": "61cbc2569de74d752e1d8c5b7f8c258bfdbde6361d84f213e5e09366fb50592c",
"name": "mtusi-lab3-clean-lb-1",
"started_at": "2026-11-01T14:16:26.273907859Z",
"status": "running",
"image": "sha256:e3229153dd6429fc71f8a9a1f1ccbf8dab6962422d7043c81e84dd6a075e90ee",
"user": "haproxy",
"memory_bytes": 134217728,
"nano_cpus": 500000000,
"published_ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "18083"
}
]
},
"volumes": []
}
]
}