forked from mtusi2026/mtusi2026lab3
feat: конф нгинкс, тесты, ключ идмпт etc
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
$ date -u +%Y-%m-%dT%H:%M:%SZ
|
||||
2026-10-19T16:59:47Z
|
||||
$ git log -1 --format="%h %s" && git status --short | wc -l | xargs echo "uncommitted files:"
|
||||
aa971fb feat: перенос core-логики 2 лабы
|
||||
uncommitted files: 42
|
||||
$ sysctl -n machdep.cpu.brand_string hw.ncpu hw.memsize
|
||||
Apple M4
|
||||
10
|
||||
17179869184
|
||||
$ docker version --format "Docker Engine {{.Server.Version}}, client {{.Client.Version}}"
|
||||
Docker Engine 29.0.1, client 29.0.1
|
||||
$ docker compose version
|
||||
Docker Compose version v2.40.3-desktop.1
|
||||
$ docker info --format "Docker VM: {{.NCPU}} CPU, {{.MemTotal}} bytes RAM, {{.OperatingSystem}}, kernel {{.KernelVersion}}"
|
||||
Docker VM: 10 CPU, 8217448448 bytes RAM, Docker Desktop, kernel 6.12.54-linuxkit
|
||||
$ python3 --version
|
||||
Python 3.9.6
|
||||
$ poetry run python --version
|
||||
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
Python 3.12.12
|
||||
@@ -0,0 +1,150 @@
|
||||
$ docker compose --env-file .env config --quiet && echo "compose config: OK"
|
||||
compose config: OK
|
||||
$ make up
|
||||
docker compose up -d --build --wait
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.17kB done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [api internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 914B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [api internal] load metadata for docker.io/library/python:3.12.12-slim-bookworm
|
||||
#3 DONE 0.3s
|
||||
|
||||
#4 [migrate internal] load .dockerignore
|
||||
#4 transferring context: 358B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [migrate 1/7] FROM docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c
|
||||
#5 resolve docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [api internal] load build context
|
||||
#6 transferring context: 16.17kB done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [api 3/7] COPY poetry.lock pyproject.toml ./
|
||||
#7 CACHED
|
||||
|
||||
#8 [api 4/7] RUN pip install --no-cache-dir --timeout 60 --retries 10 "poetry==2.2.1" && poetry install --only main --no-root --no-interaction
|
||||
#8 CACHED
|
||||
|
||||
#9 [api 2/7] WORKDIR /app
|
||||
#9 CACHED
|
||||
|
||||
#10 [api 5/7] COPY migrations ./migrations
|
||||
#10 CACHED
|
||||
|
||||
#11 [migrate 6/7] COPY src ./src
|
||||
#11 DONE 0.0s
|
||||
|
||||
#12 [migrate 7/7] RUN useradd --system --uid 10001 --no-create-home app
|
||||
#12 0.110 useradd warning: app's uid 10001 is greater than SYS_UID_MAX 999
|
||||
#12 DONE 0.1s
|
||||
|
||||
#13 [api] exporting to image
|
||||
#13 exporting layers 0.0s done
|
||||
#13 exporting manifest sha256:8d0545b5703e6c70c35f1136bdfd37c4ceb4a70d08b5bad21b70d6755df05b5d done
|
||||
#13 exporting config sha256:28c6ec56ed30844b944958f2749a370cea79cfd768ca3f491807eae51ad534a0 done
|
||||
#13 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#13 unpacking to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [migrate] exporting to image
|
||||
#14 exporting layers 0.0s done
|
||||
#14 exporting manifest sha256:9802819ef7b235f44ad03fed838cf83fcd4573a342405936538c7c969adfd573 done
|
||||
#14 exporting config sha256:e2b0c133c10bc42d53160db701c32694ed2cbac54f0522999289f4cf7cef21e1 done
|
||||
#14 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#14 unpacking to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#14 DONE 0.1s
|
||||
|
||||
#15 [api] resolving provenance for metadata file
|
||||
#15 DONE 0.0s
|
||||
|
||||
#16 [migrate] resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
mtusi-messenger:lab3 Built
|
||||
mtusi-messenger:lab3 Built
|
||||
Network messenger-lab3_edge Creating
|
||||
Network messenger-lab3_edge Created
|
||||
Network messenger-lab3_backend Creating
|
||||
Network messenger-lab3_backend Created
|
||||
Container messenger-lab3-postgres-1 Creating
|
||||
Container messenger-lab3-valkey-1 Creating
|
||||
Container messenger-lab3-valkey-1 Created
|
||||
Container messenger-lab3-postgres-1 Created
|
||||
Container messenger-lab3-migrate-1 Creating
|
||||
Container messenger-lab3-migrate-1 Created
|
||||
Container messenger-lab3-api-2 Creating
|
||||
Container messenger-lab3-api-1 Creating
|
||||
Container messenger-lab3-api-1 Created
|
||||
Container messenger-lab3-api-2 Created
|
||||
Container messenger-lab3-nginx-1 Creating
|
||||
Container messenger-lab3-nginx-1 Created
|
||||
Container messenger-lab3-postgres-1 Starting
|
||||
Container messenger-lab3-valkey-1 Starting
|
||||
Container messenger-lab3-valkey-1 Started
|
||||
Container messenger-lab3-postgres-1 Started
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-migrate-1 Starting
|
||||
Container messenger-lab3-migrate-1 Started
|
||||
Container messenger-lab3-migrate-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-migrate-1 Exited
|
||||
Container messenger-lab3-api-1 Starting
|
||||
Container messenger-lab3-api-1 Started
|
||||
Container messenger-lab3-api-2 Starting
|
||||
Container messenger-lab3-api-2 Started
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
Container messenger-lab3-nginx-1 Starting
|
||||
Container messenger-lab3-nginx-1 Started
|
||||
Container messenger-lab3-valkey-1 Waiting
|
||||
Container messenger-lab3-nginx-1 Waiting
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-migrate-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-migrate-1 Exited
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-valkey-1 Healthy
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
Container messenger-lab3-nginx-1 Healthy
|
||||
$ docker compose ps -a
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
messenger-lab3-api-1 mtusi-messenger:lab3 "python src/gateway.…" api 15 seconds ago Up 7 seconds (healthy) 8080/tcp
|
||||
messenger-lab3-api-2 mtusi-messenger:lab3 "python src/gateway.…" api 15 seconds ago Up 7 seconds (healthy) 8080/tcp
|
||||
messenger-lab3-migrate-1 mtusi-messenger:lab3 "python src/migrate.…" migrate 15 seconds ago Exited (0) 7 seconds ago
|
||||
messenger-lab3-nginx-1 nginx:1.28.0-alpine3.21 "/docker-entrypoint.…" nginx 15 seconds ago Up 5 seconds (healthy) 127.0.0.1:8080-8081->8080-8081/tcp
|
||||
messenger-lab3-postgres-1 postgres:18.2-alpine3.22 "docker-entrypoint.s…" postgres 15 seconds ago Up 14 seconds (healthy) 5432/tcp
|
||||
messenger-lab3-valkey-1 valkey/valkey:8.1.4-alpine3.22 "docker-entrypoint.s…" valkey 15 seconds ago Up 14 seconds (healthy) 6379/tcp
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 978f2777b379 95632 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ docker compose logs migrate
|
||||
migrate-1 | 2026-10-19 17:00:03.868 | INFO | infrastructure.dependencies.database:create_pool:69 - Установка соединения с базой данных psql
|
||||
migrate-1 | 2026-10-19 17:00:03.937 | INFO | infrastructure.dependencies.database:create_pool:99 - Соединение с базой данных psql установлено. DB_NAME: test, pool: 2..10
|
||||
migrate-1 | 2026-10-19 17:00:03.939 | INFO | infrastructure.dependencies.database:apply_migrations:157 - Схема БД в актуальной версии
|
||||
migrate-1 | 2026-10-19 17:00:03.940 | INFO | __main__:main:20 - Миграции применены, migrate завершается
|
||||
$ docker compose logs api | grep -E "Схема БД|Application started"
|
||||
api-2 | 2026-10-19 17:00:05.191 | INFO | infrastructure.dependencies.database:check_migrations:183 - Схема БД совместима: версия 2
|
||||
api-2 | 2026-10-19 17:00:05.226 | INFO | __main__:lifespan:45 - Application started, env=lab, revision=dev, instance=389b271f592b, session ttl=3600 s
|
||||
api-1 | 2026-10-19 17:00:05.106 | INFO | infrastructure.dependencies.database:check_migrations:183 - Схема БД совместима: версия 2
|
||||
api-1 | 2026-10-19 17:00:05.173 | INFO | __main__:lifespan:45 - Application started, env=lab, revision=dev, instance=978f2777b379, session ttl=3600 s
|
||||
$ curl -s -o /dev/null -w "%{http_code}\n" --max-time 2 http://localhost:8080/health/ready
|
||||
200
|
||||
$ docker compose exec -T nginx sh -c "wget -q -O - --timeout 2 http://api:8080/health/live; echo; nslookup api 127.0.0.11 | tail -4"
|
||||
{"status":"ok"}
|
||||
Address: 192.168.48.3
|
||||
Name: api
|
||||
Address: 192.168.48.2
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,128 @@
|
||||
$ make student-test
|
||||
BASE_URL="http://localhost:8080" poetry run pytest
|
||||
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-jSniokBX-py3.12/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab3
|
||||
configfile: pyproject.toml
|
||||
testpaths: student-tests
|
||||
plugins: anyio-4.15.1
|
||||
collecting ... collected 113 items
|
||||
|
||||
student-tests/test_auth.py::test_login_returns_opaque_bearer_session PASSED [ 0%]
|
||||
student-tests/test_auth.py::test_wrong_password_and_unknown_user_are_indistinguishable PASSED [ 1%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[None] PASSED [ 2%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[] PASSED [ 3%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic] PASSED [ 4%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic !!!not-base64!!!] PASSED [ 5%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic bm8tY29sb24taGVyZQ==] PASSED [ 6%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic //46cGFzc3dvcmQ=] PASSED [ 7%]
|
||||
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Bearer some-token] PASSED [ 7%]
|
||||
student-tests/test_auth.py::test_utf8_password_with_colon PASSED [ 8%]
|
||||
student-tests/test_auth.py::test_basic_is_rejected_on_business_endpoints PASSED [ 9%]
|
||||
student-tests/test_auth.py::test_logout_revokes_only_current_session PASSED [ 10%]
|
||||
student-tests/test_auth.py::test_logout_without_token PASSED [ 11%]
|
||||
student-tests/test_auth.py::test_relogin_after_logout PASSED [ 12%]
|
||||
student-tests/test_auth.py::test_password_is_not_stored_in_plaintext PASSED [ 13%]
|
||||
student-tests/test_balancing.py::test_one_session_is_served_by_several_replicas PASSED [ 14%]
|
||||
student-tests/test_balancing.py::test_write_is_visible_through_every_replica PASSED [ 15%]
|
||||
student-tests/test_balancing.py::test_logout_applies_to_all_replicas PASSED [ 15%]
|
||||
student-tests/test_balancing.py::test_every_api_response_has_instance_id PASSED [ 16%]
|
||||
student-tests/test_concurrency.py::test_parallel_messages_are_not_lost_or_duplicated PASSED [ 17%]
|
||||
student-tests/test_dependency_failures.py::test_valkey_down_cache_is_bypassed SKIPPED [ 18%]
|
||||
student-tests/test_dependency_failures.py::test_logout_during_valkey_outage_is_not_resurrected SKIPPED [ 19%]
|
||||
student-tests/test_dependency_failures.py::test_postgres_down_returns_bounded_503_and_no_anonymous_access SKIPPED [ 20%]
|
||||
student-tests/test_dependency_failures.py::test_session_survives_postgres_restart SKIPPED [ 21%]
|
||||
student-tests/test_expiry.py::test_session_expires_after_short_ttl SKIPPED [ 22%]
|
||||
student-tests/test_expiry.py::test_expires_at_matches_short_ttl SKIPPED [ 23%]
|
||||
student-tests/test_foreign_chat.py::test_outsider_cannot_access_chat PASSED [ 23%]
|
||||
student-tests/test_foreign_chat.py::test_foreign_and_missing_chat_are_indistinguishable PASSED [ 24%]
|
||||
student-tests/test_foreign_chat.py::test_chat_list_contains_only_own_chats PASSED [ 25%]
|
||||
student-tests/test_health.py::test_health_endpoints_have_request_id PASSED [ 26%]
|
||||
student-tests/test_health.py::test_unknown_route_uses_error_format PASSED [ 27%]
|
||||
student-tests/test_idempotency.py::test_replay_returns_same_message PASSED [ 28%]
|
||||
student-tests/test_idempotency.py::test_replay_ignores_json_formatting PASSED [ 29%]
|
||||
student-tests/test_idempotency.py::test_same_key_with_other_body_is_conflict PASSED [ 30%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers0] PASSED [ 30%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers1] PASSED [ 31%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers2] PASSED [ 32%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers3] PASSED [ 33%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers4] PASSED [ 34%]
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers5] PASSED [ 35%]
|
||||
student-tests/test_idempotency.py::test_key_boundaries_are_accepted[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 36%]
|
||||
student-tests/test_idempotency.py::test_key_boundaries_are_accepted[Az09._:-] PASSED [ 37%]
|
||||
student-tests/test_idempotency.py::test_key_scope_is_user_and_chat PASSED [ 38%]
|
||||
student-tests/test_idempotency.py::test_replay_rechecks_session_and_access PASSED [ 38%]
|
||||
student-tests/test_idempotency.py::test_expired_key_can_be_reused PASSED [ 39%]
|
||||
student-tests/test_idempotency.py::test_parallel_replays_through_replicas_create_one_message PASSED [ 40%]
|
||||
student-tests/test_idempotency.py::test_parallel_same_key_with_different_bodies PASSED [ 41%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_register[{"username": "abc",] PASSED [ 42%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_register[not json at all] PASSED [ 43%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_register[{"text": "\xff\xfe"}] PASSED [ 44%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_register[] PASSED [ 45%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[{"username": "abc",] PASSED [ 46%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[not json at all] PASSED [ 46%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[{"text": "\xff\xfe"}] PASSED [ 47%]
|
||||
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[] PASSED [ 48%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body0] PASSED [ 49%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[alice] PASSED [ 50%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body2] PASSED [ 51%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body3] PASSED [ 52%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body4] PASSED [ 53%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body5] PASSED [ 53%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body6] PASSED [ 54%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body7] PASSED [ 55%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body8] PASSED [ 56%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body9] PASSED [ 57%]
|
||||
student-tests/test_invalid_json.py::test_invalid_user_payload[body10] PASSED [ 58%]
|
||||
student-tests/test_invalid_json.py::test_invalid_message_payload[body0] PASSED [ 59%]
|
||||
student-tests/test_invalid_json.py::test_invalid_message_payload[body1] PASSED [ 60%]
|
||||
student-tests/test_invalid_json.py::test_invalid_message_payload[body2] PASSED [ 61%]
|
||||
student-tests/test_invalid_json.py::test_invalid_chat_payload PASSED [ 61%]
|
||||
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[] PASSED [ 62%]
|
||||
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[ ] PASSED [ 63%]
|
||||
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[ \n\t ] PASSED [ 64%]
|
||||
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[\u3000] PASSED [ 65%]
|
||||
student-tests/test_messages.py::test_message_length_is_counted_in_code_points PASSED [ 66%]
|
||||
student-tests/test_messages.py::test_unicode_is_preserved PASSED [ 67%]
|
||||
student-tests/test_messages.py::test_nul_character_is_rejected PASSED [ 68%]
|
||||
student-tests/test_messages.py::test_sender_is_taken_from_session PASSED [ 69%]
|
||||
student-tests/test_pagination.py::test_walk_message_pages[7-3-3] PASSED [ 69%]
|
||||
student-tests/test_pagination.py::test_walk_message_pages[6-3-2] PASSED [ 70%]
|
||||
student-tests/test_pagination.py::test_walk_message_pages[5-1-5] PASSED [ 71%]
|
||||
student-tests/test_pagination.py::test_walk_message_pages[3-100-1] PASSED [ 72%]
|
||||
student-tests/test_pagination.py::test_limit_can_change_between_pages PASSED [ 73%]
|
||||
student-tests/test_pagination.py::test_new_message_appears_after_cursor PASSED [ 74%]
|
||||
student-tests/test_pagination.py::test_cursor_is_bound_to_chat PASSED [ 75%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params0] PASSED [ 76%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params1] PASSED [ 76%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params2] PASSED [ 77%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params3] PASSED [ 78%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params4] PASSED [ 79%]
|
||||
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params5] PASSED [ 80%]
|
||||
student-tests/test_pagination.py::test_walk_chat_list_pages PASSED [ 81%]
|
||||
student-tests/test_pagination.py::test_chat_cursor_is_bound_to_user PASSED [ 82%]
|
||||
student-tests/test_transactions.py::test_same_username_race_creates_exactly_one_user PASSED [ 83%]
|
||||
student-tests/test_transactions.py::test_failed_chat_creation_is_rolled_back PASSED [ 84%]
|
||||
student-tests/test_transactions.py::test_successful_chat_creation_commits_all_members PASSED [ 84%]
|
||||
student-tests/test_users.py::test_duplicate_username_is_conflict PASSED [ 85%]
|
||||
student-tests/test_users.py::test_registration_never_returns_password PASSED [ 86%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[None] PASSED [ 87%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[] PASSED [ 88%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[\u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439] PASSED [ 89%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[xxxxxxxxxxx] PASSED [ 90%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 91%]
|
||||
student-tests/test_users.py::test_invalid_password_is_rejected[123456789012] PASSED [ 92%]
|
||||
student-tests/test_users.py::test_password_length_is_counted_in_code_points PASSED [ 92%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers0] PASSED [ 93%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers1] PASSED [ 94%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers2] PASSED [ 95%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers3] PASSED [ 96%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers4] PASSED [ 97%]
|
||||
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers5] PASSED [ 98%]
|
||||
student-tests/test_users.py::test_x_user_id_gives_no_access PASSED [ 99%]
|
||||
student-tests/test_users.py::test_current_user PASSED [100%]
|
||||
|
||||
======================= 107 passed, 6 skipped in 14.98s ========================
|
||||
@@ -0,0 +1,50 @@
|
||||
$ BASE_URL=http://localhost:8080 poetry run pytest student-tests/test_balancing.py student-tests/test_idempotency.py student-tests/test_concurrency.py -s
|
||||
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-jSniokBX-py3.12/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab3
|
||||
configfile: pyproject.toml
|
||||
plugins: anyio-4.15.1
|
||||
collecting ... collected 21 items
|
||||
|
||||
student-tests/test_balancing.py::test_one_session_is_served_by_several_replicas
|
||||
INSTANCES FOR ONE SESSION: {'389b271f592b': 10, '978f2777b379': 10}
|
||||
PASSED
|
||||
student-tests/test_balancing.py::test_write_is_visible_through_every_replica PASSED
|
||||
student-tests/test_balancing.py::test_logout_applies_to_all_replicas PASSED
|
||||
student-tests/test_balancing.py::test_every_api_response_has_instance_id PASSED
|
||||
student-tests/test_idempotency.py::test_replay_returns_same_message PASSED
|
||||
student-tests/test_idempotency.py::test_replay_ignores_json_formatting PASSED
|
||||
student-tests/test_idempotency.py::test_same_key_with_other_body_is_conflict PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers0] PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers1] PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers2] PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers3] PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers4] PASSED
|
||||
student-tests/test_idempotency.py::test_missing_or_invalid_key_is_rejected[headers5] PASSED
|
||||
student-tests/test_idempotency.py::test_key_boundaries_are_accepted[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED
|
||||
student-tests/test_idempotency.py::test_key_boundaries_are_accepted[Az09._:-] PASSED
|
||||
student-tests/test_idempotency.py::test_key_scope_is_user_and_chat PASSED
|
||||
student-tests/test_idempotency.py::test_replay_rechecks_session_and_access PASSED
|
||||
student-tests/test_idempotency.py::test_expired_key_can_be_reused PASSED
|
||||
student-tests/test_idempotency.py::test_parallel_replays_through_replicas_create_one_message
|
||||
PARALLEL SAME KEY: {"requests": 20, "statuses": {"201": 20}, "instances": {"389b271f592b": 10, "978f2777b379": 10}, "distinct_bodies": 1, "messages_in_history": 1, "rows_in_db": 1}
|
||||
PASSED
|
||||
student-tests/test_idempotency.py::test_parallel_same_key_with_different_bodies PASSED
|
||||
student-tests/test_concurrency.py::test_parallel_messages_are_not_lost_or_duplicated
|
||||
CONCURRENCY RESULT: {"clients": 10, "messages_sent": 100, "status_201": 100, "messages_read": 100, "unique_ids": 100, "unique_texts": 100, "pages_read": 4, "send_seconds": 0.227}
|
||||
PASSED
|
||||
|
||||
============================== 21 passed in 3.79s ==============================
|
||||
$ docker compose logs --no-log-prefix nginx | grep "\"uri\":\"/api/v1/users/me\",\"status\":200" | tail -6
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"d754e7abc1b3b0e09ab4bf0d9fd50270","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.001,"upstream_addr":"192.168.48.3:8080","upstream_status":"200","upstream_response_time":"0.002","instance":"389b271f592b"}
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"aeaf60de5c114ed306169370ede170b6","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.002,"upstream_addr":"192.168.48.2:8080","upstream_status":"200","upstream_response_time":"0.001","instance":"978f2777b379"}
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"7caafb063b53d8985d17356cd62d812d","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.002,"upstream_addr":"192.168.48.3:8080","upstream_status":"200","upstream_response_time":"0.001","instance":"389b271f592b"}
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"a8e4fb898cd5ff5e56bdd1669067a60f","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.001,"upstream_addr":"192.168.48.2:8080","upstream_status":"200","upstream_response_time":"0.001","instance":"978f2777b379"}
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"fb8e6ba34f06d739933b9872b9aadd89","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.001,"upstream_addr":"192.168.48.3:8080","upstream_status":"200","upstream_response_time":"0.000","instance":"389b271f592b"}
|
||||
{"time":"2026-10-19T17:01:21+00:00","request_id":"e166ba8766667300b8bcc65996ab6827","method":"GET","uri":"/api/v1/users/me","status":200,"request_time":0.001,"upstream_addr":"192.168.48.2:8080","upstream_status":"200","upstream_response_time":"0.001","instance":"978f2777b379"}
|
||||
$ rid=$(docker compose logs --no-log-prefix nginx | grep "\"uri\":\"/api/v1/users/me\",\"status\":200" | tail -1 | sed -E "s/.*\"request_id\":\"([0-9a-f]+)\".*/\1/"); echo "request_id=$rid"; docker compose logs api | grep "$rid"
|
||||
request_id=e166ba8766667300b8bcc65996ab6827
|
||||
api-1 | 2026-10-19 17:01:21.285 | INFO | application.api.middlewares.request_context:_log_request:70 - GET /api/v1/users/me -> 200 | 0.6 ms | request_id=e166ba8766667300b8bcc65996ab6827
|
||||
@@ -0,0 +1,41 @@
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 978f2777b379 95632 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 2.693}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 exited/unhealthy - 0 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ docker inspect -f "{{.Name}} status={{.State.Status}} exit={{.State.ExitCode}} finished={{.State.FinishedAt}}" $(docker compose ps -aq api)
|
||||
/messenger-lab3-api-1 status=exited exit=0 finished=2026-10-19T17:01:38.389851544Z
|
||||
/messenger-lab3-api-2 status=running exit=0 finished=0001-01-01T00:00:00Z
|
||||
$ docker compose logs api | grep -E "SIGTERM|Application stopped|Finished server process"
|
||||
api-1 | 2026-10-19 17:01:37.194 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=978f2777b379: порт закрыт, keep-alive соединения закрываются после ответа
|
||||
api-1 | 2026-10-19 17:01:38.301 | INFO | __main__:lifespan:54 - Application stopped, instance=978f2777b379, connections closed
|
||||
api-1 | INFO: Finished server process [1]
|
||||
$ docker compose logs --no-log-prefix nginx | grep -E "\[(warn|error)\]" | tail -4
|
||||
2026/10/19 17:00:46 [warn] 30#30: *43 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000001, client: 192.168.48.1, server: , request: "POST /api/v1/chats/01a1551b-c8fe-7b27-bef6-22c34e5e5367/messages HTTP/1.1", host: "localhost:8080"
|
||||
2026/10/19 17:00:46 [warn] 30#30: *43 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000002, client: 192.168.48.1, server: , request: "POST /api/v1/chats/01a1551b-c8fe-7b27-bef6-22c34e5e5367/messages HTTP/1.1", host: "localhost:8080"
|
||||
2026/10/19 17:01:38 [error] 30#30: *803 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.48.1, server: , request: "POST /api/v1/chats/01a1551c-8845-7e45-aa74-7d88537eac05/messages HTTP/1.1", upstream: "http://192.168.48.2:8080/api/v1/chats/01a1551c-8845-7e45-aa74-7d88537eac05/messages", host: "localhost:8080"
|
||||
2026/10/19 17:01:38 [warn] 30#30: *803 upstream server temporarily disabled while connecting to upstream, client: 192.168.48.1, server: , request: "POST /api/v1/chats/01a1551c-8845-7e45-aa74-7d88537eac05/messages HTTP/1.1", upstream: "http://192.168.48.2:8080/api/v1/chats/01a1551c-8845-7e45-aa74-7d88537eac05/messages", host: "localhost:8080"
|
||||
$ make restore
|
||||
./scripts/restore.sh
|
||||
Container messenger-lab3-api-2 Running
|
||||
Container messenger-lab3-api-1 Starting
|
||||
Container messenger-lab3-api-1 Started
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy b0b074af6d9c 18674 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
@@ -0,0 +1,69 @@
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy b0b074af6d9c 18674 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 1.616}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 exited/unhealthy - 0 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ docker inspect -f "{{.Name}} status={{.State.Status}} exit={{.State.ExitCode}} finished={{.State.FinishedAt}}" $(docker compose ps -aq api)
|
||||
/messenger-lab3-api-1 status=exited exit=0 finished=2026-10-19T17:02:10.511955087Z
|
||||
/messenger-lab3-api-2 status=running exit=0 finished=0001-01-01T00:00:00Z
|
||||
$ make restore
|
||||
./scripts/restore.sh
|
||||
Container messenger-lab3-api-2 Running
|
||||
Container messenger-lab3-api-1 Starting
|
||||
Container messenger-lab3-api-1 Started
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||||
$ curl -s -o /dev/null -w "shift round-robin: %{http_code}\n" http://localhost:8080/health/live
|
||||
shift round-robin: 200
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 1.618}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||||
messenger-lab3-api-2 exited/unhealthy - 0 dev
|
||||
$ docker inspect -f "{{.Name}} status={{.State.Status}} exit={{.State.ExitCode}} finished={{.State.FinishedAt}}" $(docker compose ps -aq api)
|
||||
/messenger-lab3-api-1 status=running exit=0 finished=2026-10-19T17:02:10.511955087Z
|
||||
/messenger-lab3-api-2 status=exited exit=0 finished=2026-10-19T17:02:43.134886046Z
|
||||
$ docker compose logs api-2 2>/dev/null | grep -E "SIGTERM|Application stopped|Finished server process" || docker compose logs api | grep -E "SIGTERM|Application stopped" | tail -2
|
||||
api-1 | 2026-10-19 17:02:09.336 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=b0b074af6d9c: порт закрыт, keep-alive соединения закрываются после ответа
|
||||
api-1 | 2026-10-19 17:02:10.443 | INFO | __main__:lifespan:54 - Application stopped, instance=b0b074af6d9c, connections closed
|
||||
$ make restore
|
||||
./scripts/restore.sh
|
||||
Container messenger-lab3-api-1 Running
|
||||
Container messenger-lab3-api-2 Starting
|
||||
Container messenger-lab3-api-2 Started
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||||
messenger-lab3-api-2 running/healthy 774df521af21 22387 dev
|
||||
$ docker logs messenger-lab3-api-2 2>&1 | grep -E "instance=389b271f592b|Finished server process"
|
||||
2026-10-19 17:00:05.226 | INFO | __main__:lifespan:45 - Application started, env=lab, revision=dev, instance=389b271f592b, session ttl=3600 s
|
||||
2026-10-19 17:02:41.948 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=389b271f592b: порт закрыт, keep-alive соединения закрываются после ответа
|
||||
2026-10-19 17:02:43.068 | INFO | __main__:lifespan:54 - Application stopped, instance=389b271f592b, connections closed
|
||||
INFO: Finished server process [1]
|
||||
@@ -0,0 +1,37 @@
|
||||
$ cat scripts/restart.sh
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
# Перезапуск всего стенда с сохранением volumes: хранилища (PostgreSQL, Valkey),
|
||||
# затем все API-реплики и балансировщик. Никаких down -v, flush или повторного
|
||||
# seed; migrate не запускается — схема уже в volume. Готовность ждёт тест.
|
||||
cd "$(dirname "$0")/.."
|
||||
ENV_FILE="${ENV_FILE:-.env}"
|
||||
|
||||
docker compose --env-file "$ENV_FILE" restart --no-deps postgres valkey
|
||||
docker compose --env-file "$ENV_FILE" restart --no-deps api
|
||||
docker compose --env-file "$ENV_FILE" restart --no-deps nginx
|
||||
$ docker inspect -f "{{.Name}} started={{.State.StartedAt}}" $(docker compose ps -q)
|
||||
/messenger-lab3-api-1 started=2026-10-19T17:02:39.217903586Z
|
||||
/messenger-lab3-api-2 started=2026-10-19T17:02:57.444596886Z
|
||||
/messenger-lab3-nginx-1 started=2026-10-19T17:00:06.004414293Z
|
||||
/messenger-lab3-postgres-1 started=2026-10-19T16:59:57.066060636Z
|
||||
/messenger-lab3-valkey-1 started=2026-10-19T16:59:57.064188719Z
|
||||
$ docker volume inspect -f "{{.Name}} created={{.CreatedAt}}" messenger-lab3_postgres_data
|
||||
messenger-lab3_postgres_data created=2026-10-19T16:10:27Z
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost: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.
|
||||
$ docker inspect -f "{{.Name}} started={{.State.StartedAt}}" $(docker compose ps -q)
|
||||
/messenger-lab3-api-1 started=2026-10-19T17:03:17.125014673Z
|
||||
/messenger-lab3-api-2 started=2026-10-19T17:03:17.151381881Z
|
||||
/messenger-lab3-nginx-1 started=2026-10-19T17:03:17.57774484Z
|
||||
/messenger-lab3-postgres-1 started=2026-10-19T17:03:15.504400631Z
|
||||
/messenger-lab3-valkey-1 started=2026-10-19T17:03:15.535674256Z
|
||||
$ docker volume inspect -f "{{.Name}} created={{.CreatedAt}}" messenger-lab3_postgres_data
|
||||
messenger-lab3_postgres_data created=2026-10-19T16:10:27Z
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy bfb3f7bbb85d 23878 dev
|
||||
messenger-lab3-api-2 running/healthy 6d2f6cd2b04a 23926 dev
|
||||
@@ -0,0 +1,108 @@
|
||||
$ make test-expiry
|
||||
docker compose --profile expiry up -d --build --wait api-short-ttl
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.20kB done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [api-short-ttl internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 914B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [api-short-ttl internal] load metadata for docker.io/library/python:3.12.12-slim-bookworm
|
||||
#3 DONE 0.1s
|
||||
|
||||
#4 [api-short-ttl internal] load .dockerignore
|
||||
#4 transferring context: 358B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [api-short-ttl 1/7] FROM docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c
|
||||
#5 resolve docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [api-short-ttl internal] load build context
|
||||
#6 transferring context: 7.39kB done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [migrate 5/7] COPY migrations ./migrations
|
||||
#7 CACHED
|
||||
|
||||
#8 [migrate 4/7] RUN pip install --no-cache-dir --timeout 60 --retries 10 "poetry==2.2.1" && poetry install --only main --no-root --no-interaction
|
||||
#8 CACHED
|
||||
|
||||
#9 [migrate 2/7] WORKDIR /app
|
||||
#9 CACHED
|
||||
|
||||
#10 [migrate 6/7] COPY src ./src
|
||||
#10 CACHED
|
||||
|
||||
#11 [migrate 3/7] COPY poetry.lock pyproject.toml ./
|
||||
#11 CACHED
|
||||
|
||||
#12 [api-short-ttl 7/7] RUN useradd --system --uid 10001 --no-create-home app
|
||||
#12 CACHED
|
||||
|
||||
#13 [migrate] exporting to image
|
||||
#13 exporting layers done
|
||||
#13 exporting manifest sha256:9802819ef7b235f44ad03fed838cf83fcd4573a342405936538c7c969adfd573 done
|
||||
#13 exporting config sha256:e2b0c133c10bc42d53160db701c32694ed2cbac54f0522999289f4cf7cef21e1 done
|
||||
#13 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#13 unpacking to docker.io/library/mtusi-messenger:lab3 done
|
||||
#13 DONE 0.0s
|
||||
|
||||
#14 [api-short-ttl] exporting to image
|
||||
#14 exporting layers done
|
||||
#14 exporting manifest sha256:036b7dde37a28a3eeec751ce6ada2034e1a9a1d76cd9310dbd3cd157824ea087 done
|
||||
#14 exporting config sha256:26fb210928fa7201fedcce1e64d506079d863ddc42532dc4d25f1f77d673e3b3 done
|
||||
#14 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#14 unpacking to docker.io/library/mtusi-messenger:lab3 done
|
||||
#14 DONE 0.0s
|
||||
|
||||
#15 [migrate] resolving provenance for metadata file
|
||||
#15 DONE 0.0s
|
||||
|
||||
#16 [api-short-ttl] resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
mtusi-messenger:lab3 Built
|
||||
mtusi-messenger:lab3 Built
|
||||
Container messenger-lab3-valkey-1 Running
|
||||
Container messenger-lab3-postgres-1 Running
|
||||
Container messenger-lab3-migrate-1 Recreate
|
||||
Container messenger-lab3-migrate-1 Recreated
|
||||
Container messenger-lab3-api-short-ttl-1 Creating
|
||||
Container messenger-lab3-api-short-ttl-1 Created
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-migrate-1 Starting
|
||||
Container messenger-lab3-migrate-1 Started
|
||||
Container messenger-lab3-migrate-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-migrate-1 Exited
|
||||
Container messenger-lab3-api-short-ttl-1 Starting
|
||||
Container messenger-lab3-api-short-ttl-1 Started
|
||||
Container messenger-lab3-api-short-ttl-1 Waiting
|
||||
Container messenger-lab3-migrate-1 Waiting
|
||||
Container messenger-lab3-postgres-1 Waiting
|
||||
Container messenger-lab3-valkey-1 Waiting
|
||||
Container messenger-lab3-migrate-1 Exited
|
||||
Container messenger-lab3-valkey-1 Healthy
|
||||
Container messenger-lab3-postgres-1 Healthy
|
||||
Container messenger-lab3-api-short-ttl-1 Healthy
|
||||
EXPIRY_BASE_URL=http://localhost:8081 poetry run pytest student-tests/test_expiry.py -s; \
|
||||
status=$?; docker compose --profile expiry stop api-short-ttl; exit $status
|
||||
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-jSniokBX-py3.12/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab3
|
||||
configfile: pyproject.toml
|
||||
plugins: anyio-4.15.1
|
||||
collecting ... collected 2 items
|
||||
|
||||
student-tests/test_expiry.py::test_session_expires_after_short_ttl PASSED
|
||||
student-tests/test_expiry.py::test_expires_at_matches_short_ttl PASSED
|
||||
|
||||
============================== 2 passed in 3.54s ===============================
|
||||
Container messenger-lab3-api-short-ttl-1 Stopping
|
||||
Container messenger-lab3-api-short-ttl-1 Stopped
|
||||
@@ -0,0 +1,24 @@
|
||||
$ make test-failures
|
||||
BASE_URL="http://localhost:8080" RUN_FAILURE_TESTS=1 poetry run pytest student-tests/test_dependency_failures.py -s
|
||||
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-jSniokBX-py3.12/bin/python
|
||||
cachedir: .pytest_cache
|
||||
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab3
|
||||
configfile: pyproject.toml
|
||||
plugins: anyio-4.15.1
|
||||
collecting ... collected 4 items
|
||||
|
||||
student-tests/test_dependency_failures.py::test_valkey_down_cache_is_bypassed PASSED
|
||||
student-tests/test_dependency_failures.py::test_logout_during_valkey_outage_is_not_resurrected PASSED
|
||||
student-tests/test_dependency_failures.py::test_postgres_down_returns_bounded_503_and_no_anonymous_access PASSED
|
||||
student-tests/test_dependency_failures.py::test_session_survives_postgres_restart PASSED
|
||||
|
||||
============================== 4 passed in 11.79s ==============================
|
||||
$ docker compose ps --format "{{.Name}}\t{{.Status}}"
|
||||
messenger-lab3-api-1 Up 12 hours (healthy)
|
||||
messenger-lab3-api-2 Up 12 hours (healthy)
|
||||
messenger-lab3-nginx-1 Up 12 hours (healthy)
|
||||
messenger-lab3-postgres-1 Up Less than a second (health: starting)
|
||||
messenger-lab3-valkey-1 Up 8 seconds (healthy)
|
||||
@@ -0,0 +1,22 @@
|
||||
$ make test-migrations
|
||||
./scripts/check_migrations.sh
|
||||
2026-10-20 04:55:31.041 | INFO | infrastructure.dependencies.database:create_pool:69 - Установка соединения с базой данных psql
|
||||
2026-10-20 04:55:31.118 | INFO | infrastructure.dependencies.database:create_pool:99 - Соединение с базой данных psql установлено. DB_NAME: test, pool: 2..10
|
||||
пустой volume: таблиц в public = 0
|
||||
API до migrate: В БД не применены миграции [1, 2]: сначала запустите migrate
|
||||
2026-10-20 04:55:31.132 | INFO | infrastructure.dependencies.database:apply_migrations:152 - Применена миграция 0001_init.sql
|
||||
2026-10-20 04:55:31.134 | INFO | infrastructure.dependencies.database:apply_migrations:152 - Применена миграция 0002_message_idempotency.sql
|
||||
2026-10-20 04:55:31.134 | INFO | infrastructure.dependencies.database:apply_migrations:157 - Схема БД в актуальной версии
|
||||
запуск 1: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency')], таблиц = 7
|
||||
2026-10-20 04:55:31.135 | INFO | infrastructure.dependencies.database:apply_migrations:157 - Схема БД в актуальной версии
|
||||
запуск 2: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency')], таблиц = 7
|
||||
2026-10-20 04:55:31.136 | INFO | infrastructure.dependencies.database:apply_migrations:157 - Схема БД в актуальной версии
|
||||
запуск 3: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency')], таблиц = 7
|
||||
2026-10-20 04:55:31.136 | INFO | infrastructure.dependencies.database:check_migrations:183 - Схема БД совместима: версия 2
|
||||
API после migrate: схема совместима
|
||||
$ BUILDX_NO_DEFAULT_ATTESTATIONS=1 ./scripts/check_previous_version.sh
|
||||
previous version image: mtusi-messenger:compat-aa971fb (aa971fb feat: перенос core-логики 2 лабы)
|
||||
schema on stand: 0001_init, 0002_message_idempotency
|
||||
{"ready": true, "register": 201, "login": 201, "create_chat": 201, "send_message_without_key": 201, "read_history": 200, "history_matches": true}
|
||||
startup log: ['Схема БД в актуальной версии']
|
||||
PASS: previous API version works on the current schema (expand-only migration)
|
||||
@@ -0,0 +1,54 @@
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy bfb3f7bbb85d 23878 dev
|
||||
messenger-lab3-api-2 running/healthy 6d2f6cd2b04a 23926 dev
|
||||
$ make sigterm-check
|
||||
python3 scripts/sigterm_check.py --base-url "http://localhost:8080"
|
||||
Журнал реплики после SIGTERM:
|
||||
2026-10-20 04:55:46.580 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=bfb3f7bbb85d: порт закрыт, keep-alive соединения закрываются после ответа
|
||||
INFO: Shutting down
|
||||
INFO: Waiting for application shutdown.
|
||||
2026-10-20 04:55:47.701 | INFO | __main__:lifespan:54 - Application stopped, instance=bfb3f7bbb85d, connections closed
|
||||
INFO: Application shutdown complete.
|
||||
INFO: Finished server process [1]
|
||||
{
|
||||
"container": "messenger-lab3-api-1",
|
||||
"instance": "bfb3f7bbb85d",
|
||||
"exit_code": 0,
|
||||
"shutdown_seconds": 1.53,
|
||||
"limit_seconds": 10,
|
||||
"instances_before": [
|
||||
"6d2f6cd2b04a",
|
||||
"bfb3f7bbb85d"
|
||||
],
|
||||
"probes_ok_after_sigterm": 354,
|
||||
"instances_after_sigterm": [
|
||||
"6d2f6cd2b04a",
|
||||
"bfb3f7bbb85d"
|
||||
],
|
||||
"last_target_response_after_sigterm_seconds": 0.133,
|
||||
"target_responses_after_exit": 0,
|
||||
"errors_after_sigterm": 0,
|
||||
"error_kinds": []
|
||||
}
|
||||
PASS: SIGTERM завершил messenger-lab3-api-1 за 1.53 с, LB обслужил 354 запросов без ошибок
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 exited/unhealthy - 0 dev
|
||||
messenger-lab3-api-2 running/healthy 6d2f6cd2b04a 23926 dev
|
||||
$ make restore
|
||||
./scripts/restore.sh
|
||||
Container messenger-lab3-api-2 Running
|
||||
Container messenger-lab3-api-1 Starting
|
||||
Container messenger-lab3-api-1 Started
|
||||
Container messenger-lab3-api-1 Waiting
|
||||
Container messenger-lab3-api-2 Waiting
|
||||
Container messenger-lab3-api-1 Healthy
|
||||
Container messenger-lab3-api-2 Healthy
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 7535b2ed4434 69183 dev
|
||||
messenger-lab3-api-2 running/healthy 6d2f6cd2b04a 23926 dev
|
||||
@@ -0,0 +1,33 @@
|
||||
$ docker inspect -f "{{.Name}} cpus={{.HostConfig.NanoCpus}} memory={{.HostConfig.Memory}} restart={{.HostConfig.RestartPolicy.Name}} ports={{json .HostConfig.PortBindings}}" $(docker compose ps -aq)
|
||||
/messenger-lab3-api-1 cpus=1000000000 memory=536870912 restart=unless-stopped ports={}
|
||||
/messenger-lab3-api-2 cpus=1000000000 memory=536870912 restart=unless-stopped ports={}
|
||||
/messenger-lab3-api-short-ttl-1 cpus=1000000000 memory=536870912 restart=unless-stopped ports={}
|
||||
/messenger-lab3-migrate-1 cpus=500000000 memory=268435456 restart=no ports={}
|
||||
/messenger-lab3-nginx-1 cpus=500000000 memory=67108864 restart=unless-stopped ports={"8080/tcp":[{"HostIp":"127.0.0.1","HostPort":"8080"}],"8081/tcp":[{"HostIp":"127.0.0.1","HostPort":"8081"}]}
|
||||
/messenger-lab3-postgres-1 cpus=1500000000 memory=536870912 restart=unless-stopped ports={}
|
||||
/messenger-lab3-valkey-1 cpus=250000000 memory=100663296 restart=unless-stopped ports={}
|
||||
$ for n in messenger-lab3_edge messenger-lab3_backend; do docker network inspect -f "{{.Name}} internal={{.Internal}} containers={{range .Containers}}{{.Name}} {{end}}" $n; done
|
||||
messenger-lab3_edge internal=false containers=messenger-lab3-api-2 messenger-lab3-api-1 messenger-lab3-nginx-1
|
||||
messenger-lab3_backend internal=true containers=messenger-lab3-api-2 messenger-lab3-valkey-1 messenger-lab3-postgres-1 messenger-lab3-api-1
|
||||
$ grep -n "container_name" compose.yaml || echo "container_name: not used"
|
||||
container_name: not used
|
||||
$ docker compose config | grep -E "^\s+(published|target):" | sort | uniq -c
|
||||
1 published: "8080"
|
||||
1 published: "8081"
|
||||
1 target: /etc/nginx/errors.conf
|
||||
1 target: /etc/nginx/nginx.conf
|
||||
1 target: /var/lib/postgresql
|
||||
1 target: 8080
|
||||
1 target: 8081
|
||||
$ docker compose exec -T nginx sh -c "wget -q -O - --timeout 2 http://postgres:5432 2>&1 | head -1; nslookup postgres 127.0.0.11 2>&1 | tail -2"
|
||||
wget: bad address 'postgres:5432'
|
||||
** server can't find postgres: NXDOMAIN
|
||||
|
||||
$ curl -s --max-time 2 http://localhost:5432 >/dev/null 2>&1 && echo "5432 open" || echo "host 127.0.0.1:5432: closed"
|
||||
host 127.0.0.1:5432: closed
|
||||
$ docker stats --no-stream --format "{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" $(docker compose ps -q)
|
||||
messenger-lab3-api-1 0.25% 45.73MiB / 512MiB
|
||||
messenger-lab3-api-2 0.21% 45.42MiB / 512MiB
|
||||
messenger-lab3-nginx-1 0.03% 2.59MiB / 64MiB
|
||||
messenger-lab3-postgres-1 1.15% 30.5MiB / 512MiB
|
||||
messenger-lab3-valkey-1 0.22% 11.04MiB / 96MiB
|
||||
@@ -0,0 +1,18 @@
|
||||
$ python3 tests/load.py --duration 30 --concurrency 4 --output evidence/load.json
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.024,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 21418,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 713.369,
|
||||
"successful_latency_ms": {
|
||||
"p50": 4.748,
|
||||
"p95": 8.395,
|
||||
"p99": 22.531
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 7535b2ed4434 69183 dev
|
||||
messenger-lab3-api-2 running/healthy 6d2f6cd2b04a 23926 dev
|
||||
$ make experiment-failover
|
||||
python3 scripts/experiment.py failover --base-url "http://localhost:8080" --output evidence/experiment-failover.json
|
||||
== SIGTERM messenger-lab3-api-1 (instance 7535b2ed4434)
|
||||
{"scenario": "SIGTERM messenger-lab3-api-1", "rps_ok_write": {"before": 381.6, "during": 276.9, "after": 398.9}, "rps_ok_read": {"before": 381.6, "during": 276.8, "after": 399.0}, "errors": {"before": 0, "during": 0, "after": 0}, "recovery": {"write_errors": 0, "error_kinds": {}, "write_recovery_seconds": 0.0, "max_write_gap_seconds": 0.063}, "target_responses_while_stopped": 0, "restored_replica_in_rotation_seconds": 0.971, "instances_seen_from_action": {"6d2f6cd2b04a": [-10.128, 21.291], "7535b2ed4434": [-10.128, 0.032], "eb1dace786c6": [14.257, 21.289]}, "integrity": {"messages_in_history": 10740, "confirmed_unique": 10740, "confirmed_missing_or_changed": 0, "duplicate_ids": 0, "duplicate_texts": 0, "retried_writes_confirmed_as_replay": 0}}
|
||||
== SIGTERM messenger-lab3-api-2 (instance 6d2f6cd2b04a)
|
||||
{"scenario": "SIGTERM messenger-lab3-api-2", "rps_ok_write": {"before": 401.3, "during": 282.3, "after": 362.4}, "rps_ok_read": {"before": 401.1, "during": 282.4, "after": 362.5}, "errors": {"before": 0, "during": 0, "after": 0}, "recovery": {"write_errors": 0, "error_kinds": {}, "write_recovery_seconds": 0.0, "max_write_gap_seconds": 0.071}, "target_responses_while_stopped": 0, "restored_replica_in_rotation_seconds": 3.736, "instances_seen_from_action": {"6d2f6cd2b04a": [-10.122, 0.079], "eb1dace786c6": [-10.121, 21.19], "577316c523cb": [16.921, 21.191]}, "integrity": {"messages_in_history": 10687, "confirmed_unique": 10687, "confirmed_missing_or_changed": 0, "duplicate_ids": 0, "duplicate_texts": 0, "retried_writes_confirmed_as_replay": 0}}
|
||||
== SIGKILL messenger-lab3-api-1 (instance eb1dace786c6)
|
||||
{"scenario": "SIGKILL messenger-lab3-api-1", "rps_ok_write": {"before": 427.4, "during": 281.4, "after": 408.2}, "rps_ok_read": {"before": 427.3, "during": 281.3, "after": 408.5}, "errors": {"before": 0, "during": 1, "after": 0}, "recovery": {"write_errors": 1, "error_kinds": {"HTTP 503": 1}, "write_recovery_seconds": 0.0, "max_write_gap_seconds": 0.07}, "target_responses_while_stopped": 0, "restored_replica_in_rotation_seconds": 0.79, "instances_seen_from_action": {"eb1dace786c6": [-9.73, 0.024], "577316c523cb": [-9.73, 20.11], "506b547ba744": [12.893, 20.111]}, "integrity": {"messages_in_history": 10837, "confirmed_unique": 10837, "confirmed_missing_or_changed": 0, "duplicate_ids": 0, "duplicate_texts": 0, "retried_writes_confirmed_as_replay": 0}}
|
||||
== SIGKILL messenger-lab3-api-2 (instance 577316c523cb)
|
||||
{"scenario": "SIGKILL messenger-lab3-api-2", "rps_ok_write": {"before": 387.4, "during": 276.7, "after": 373.2}, "rps_ok_read": {"before": 387.1, "during": 276.8, "after": 373.3}, "errors": {"before": 0, "during": 3, "after": 0}, "recovery": {"write_errors": 3, "error_kinds": {"HTTP 503": 3}, "write_recovery_seconds": 0.006, "max_write_gap_seconds": 0.061}, "target_responses_while_stopped": 0, "restored_replica_in_rotation_seconds": 0.0, "instances_seen_from_action": {"506b547ba744": [-9.94, 20.189], "577316c523cb": [-9.939, 0.028], "1c20e7f6dbde": [11.911, 20.19]}, "integrity": {"messages_in_history": 10212, "confirmed_unique": 10212, "confirmed_missing_or_changed": 0, "duplicate_ids": 0, "duplicate_texts": 0, "retried_writes_confirmed_as_replay": 0}}
|
||||
saved: evidence/experiment-failover.json
|
||||
PASS: прогонов 4, подтверждённые сообщения целы, дублей нет
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 506b547ba744 76140 dev
|
||||
messenger-lab3-api-2 running/healthy 1c20e7f6dbde 77892 dev
|
||||
@@ -0,0 +1,18 @@
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-1 running/healthy 506b547ba744 76140 dev
|
||||
messenger-lab3-api-2 running/healthy 1c20e7f6dbde 77892 dev
|
||||
$ make experiment-rolling
|
||||
python3 scripts/experiment.py rolling --base-url "http://localhost:8080" --output evidence/experiment-rolling.json
|
||||
== rolling update to revision exp-1792472327
|
||||
{"scenario": "rolling update", "rps_ok_write": {"before": 420.1, "during": 308.0, "after": 345.4}, "rps_ok_read": {"before": 419.9, "during": 307.9, "after": 345.5}, "errors": {"before": 0, "during": 0, "after": 0}, "recovery": {"write_errors": 0, "error_kinds": {}, "write_recovery_seconds": 0.0, "max_write_gap_seconds": 0.098}, "target_responses_while_stopped": null, "restored_replica_in_rotation_seconds": null, "instances_seen_from_action": {"506b547ba744": [-9.228, 8.14], "1c20e7f6dbde": [-9.227, 14.911], "27601bb40a21": [4.875, 24.355], "e7e986ee1b58": [13.885, 24.355]}, "integrity": {"messages_in_history": 11682, "confirmed_unique": 11682, "confirmed_missing_or_changed": 0, "duplicate_ids": 0, "duplicate_texts": 0, "retried_writes_confirmed_as_replay": 0}}
|
||||
saved: evidence/experiment-rolling.json
|
||||
PASS: прогонов 1, подтверждённые сообщения целы, дублей нет
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
messenger-lab3-api-3 running/healthy 27601bb40a21 79887 exp-1792472327
|
||||
messenger-lab3-api-4 running/healthy e7e986ee1b58 80346 exp-1792472327
|
||||
$ docker compose logs --no-log-prefix nginx --since 3m | grep -cE "prematurely closed" || true
|
||||
4
|
||||
@@ -0,0 +1,192 @@
|
||||
$ echo "COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME (отдельный проект: рабочий стенд не затрагивается)"
|
||||
COMPOSE_PROJECT_NAME=lab3-clean (отдельный проект: рабочий стенд не затрагивается)
|
||||
$ cp .env.example .env && sed -i "" "s/^DB_PASS=.*/DB_PASS=$(openssl rand -hex 16)/; s/^VALKEY_PASS=.*/VALKEY_PASS=$(openssl rand -hex 16)/; s/^LB_PORT=.*/LB_PORT=18080/" .env && echo "LB_EXPIRY_PORT=18081" >> .env && echo ".env created from .env.example with random synthetic secrets"
|
||||
.env created from .env.example with random synthetic secrets
|
||||
$ docker compose --env-file .env config --quiet && echo "compose config: OK"
|
||||
compose config: OK
|
||||
$ make up
|
||||
docker compose up -d --build --wait
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.47kB done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [api internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 914B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [api internal] load metadata for docker.io/library/python:3.12.12-slim-bookworm
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [api internal] load .dockerignore
|
||||
#4 transferring context: 358B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [api 1/7] FROM docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c
|
||||
#5 resolve docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [api internal] load build context
|
||||
#6 transferring context: 184.06kB 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [api 2/7] WORKDIR /app
|
||||
#7 CACHED
|
||||
|
||||
#8 [api 4/7] RUN pip install --no-cache-dir --timeout 60 --retries 10 "poetry==2.2.1" && poetry install --only main --no-root --no-interaction
|
||||
#8 CACHED
|
||||
|
||||
#9 [api 3/7] COPY poetry.lock pyproject.toml ./
|
||||
#9 CACHED
|
||||
|
||||
#10 [migrate 5/7] COPY migrations ./migrations
|
||||
#10 CACHED
|
||||
|
||||
#11 [migrate 6/7] COPY src ./src
|
||||
#11 DONE 0.0s
|
||||
|
||||
#12 [api 7/7] RUN useradd --system --uid 10001 --no-create-home app
|
||||
#12 0.118 useradd warning: app's uid 10001 is greater than SYS_UID_MAX 999
|
||||
#12 DONE 0.1s
|
||||
|
||||
#13 [migrate] exporting to image
|
||||
#13 exporting layers 0.0s done
|
||||
#13 exporting manifest sha256:a99a66062da552c44bf2543747fc3ac215605d7487b93882f0248f46ae71dbf5 done
|
||||
#13 exporting config sha256:53e2ac5d5830524705f0737d78b69d4f9c1ca9670b8a24788c8717a7d772898f done
|
||||
#13 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#13 unpacking to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [api] exporting to image
|
||||
#14 exporting layers 0.0s done
|
||||
#14 exporting manifest sha256:47e4d0732ca8d624529f0f775abf4cd8457445931de74053dec5bbab49de873b done
|
||||
#14 exporting config sha256:d6557e51b469086507b892558ee5960f31b77943d8c8fddc381e955e4eb3718a done
|
||||
#14 naming to docker.io/library/mtusi-messenger:lab3 done
|
||||
#14 unpacking to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#14 DONE 0.1s
|
||||
|
||||
#15 [migrate] resolving provenance for metadata file
|
||||
#15 DONE 0.0s
|
||||
|
||||
#16 [api] resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
mtusi-messenger:lab3 Built
|
||||
mtusi-messenger:lab3 Built
|
||||
Network lab3-clean_backend Creating
|
||||
Network lab3-clean_backend Created
|
||||
Network lab3-clean_edge Creating
|
||||
Network lab3-clean_edge Created
|
||||
Volume lab3-clean_postgres_data Creating
|
||||
Volume lab3-clean_postgres_data Created
|
||||
Container lab3-clean-valkey-1 Creating
|
||||
Container lab3-clean-postgres-1 Creating
|
||||
Container lab3-clean-valkey-1 Created
|
||||
Container lab3-clean-postgres-1 Created
|
||||
Container lab3-clean-migrate-1 Creating
|
||||
Container lab3-clean-migrate-1 Created
|
||||
Container lab3-clean-api-2 Creating
|
||||
Container lab3-clean-api-1 Creating
|
||||
Container lab3-clean-api-2 Created
|
||||
Container lab3-clean-api-1 Created
|
||||
Container lab3-clean-nginx-1 Creating
|
||||
Container lab3-clean-nginx-1 Created
|
||||
Container lab3-clean-valkey-1 Starting
|
||||
Container lab3-clean-postgres-1 Starting
|
||||
Container lab3-clean-postgres-1 Started
|
||||
Container lab3-clean-postgres-1 Waiting
|
||||
Container lab3-clean-valkey-1 Started
|
||||
Container lab3-clean-postgres-1 Healthy
|
||||
Container lab3-clean-migrate-1 Starting
|
||||
Container lab3-clean-migrate-1 Started
|
||||
Container lab3-clean-migrate-1 Waiting
|
||||
Container lab3-clean-postgres-1 Waiting
|
||||
Container lab3-clean-postgres-1 Healthy
|
||||
Container lab3-clean-migrate-1 Exited
|
||||
Container lab3-clean-api-1 Starting
|
||||
Container lab3-clean-api-1 Started
|
||||
Container lab3-clean-api-2 Starting
|
||||
Container lab3-clean-api-2 Started
|
||||
Container lab3-clean-api-1 Waiting
|
||||
Container lab3-clean-api-2 Waiting
|
||||
Container lab3-clean-api-1 Healthy
|
||||
Container lab3-clean-api-2 Healthy
|
||||
Container lab3-clean-nginx-1 Starting
|
||||
Container lab3-clean-nginx-1 Started
|
||||
Container lab3-clean-postgres-1 Waiting
|
||||
Container lab3-clean-valkey-1 Waiting
|
||||
Container lab3-clean-nginx-1 Waiting
|
||||
Container lab3-clean-api-1 Waiting
|
||||
Container lab3-clean-api-2 Waiting
|
||||
Container lab3-clean-migrate-1 Waiting
|
||||
Container lab3-clean-valkey-1 Healthy
|
||||
Container lab3-clean-postgres-1 Healthy
|
||||
Container lab3-clean-migrate-1 Exited
|
||||
Container lab3-clean-api-1 Healthy
|
||||
Container lab3-clean-api-2 Healthy
|
||||
Container lab3-clean-nginx-1 Healthy
|
||||
$ make check test BASE_URL=http://localhost:18080
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
python3 tests/smoke.py --base-url "http://localhost:18080"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://localhost:18080
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:18080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 2.118}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ make instances
|
||||
./scripts/instances.sh
|
||||
CONTAINER STATE INSTANCE PID REVISION
|
||||
lab3-clean-api-1 exited/unhealthy - 0 dev
|
||||
lab3-clean-api-2 running/healthy 4a226e142873 83992 dev
|
||||
$ make restore
|
||||
./scripts/restore.sh
|
||||
Container lab3-clean-api-2 Running
|
||||
Container lab3-clean-api-1 Starting
|
||||
Container lab3-clean-api-1 Started
|
||||
Container lab3-clean-api-1 Waiting
|
||||
Container lab3-clean-api-2 Waiting
|
||||
Container lab3-clean-api-1 Healthy
|
||||
Container lab3-clean-api-2 Healthy
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://localhost:18080
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:18080"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ docker compose ps -a
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
lab3-clean-api-1 mtusi-messenger:lab3 "python src/gateway.…" api 43 seconds ago Up 6 seconds (healthy) 8080/tcp
|
||||
lab3-clean-api-2 mtusi-messenger:lab3 "python src/gateway.…" api 43 seconds ago Up 6 seconds (healthy) 8080/tcp
|
||||
lab3-clean-migrate-1 mtusi-messenger:lab3 "python src/migrate.…" migrate 43 seconds ago Exited (0) 35 seconds ago
|
||||
lab3-clean-nginx-1 nginx:1.28.0-alpine3.21 "/docker-entrypoint.…" nginx 43 seconds ago Up 5 seconds (healthy) 127.0.0.1:18080->8080/tcp, 127.0.0.1:18081->8081/tcp
|
||||
lab3-clean-postgres-1 postgres:18.2-alpine3.22 "docker-entrypoint.s…" postgres 44 seconds ago Up 8 seconds (healthy) 5432/tcp
|
||||
lab3-clean-valkey-1 valkey/valkey:8.1.4-alpine3.22 "docker-entrypoint.s…" valkey 44 seconds ago Up 8 seconds (healthy) 6379/tcp
|
||||
$ docker compose --profile expiry down -v
|
||||
Container lab3-clean-nginx-1 Stopping
|
||||
Container lab3-clean-nginx-1 Stopped
|
||||
Container lab3-clean-nginx-1 Removing
|
||||
Container lab3-clean-nginx-1 Removed
|
||||
Container lab3-clean-api-2 Stopping
|
||||
Container lab3-clean-api-1 Stopping
|
||||
Container lab3-clean-api-1 Stopped
|
||||
Container lab3-clean-api-1 Removing
|
||||
Container lab3-clean-api-1 Removed
|
||||
Container lab3-clean-api-2 Stopped
|
||||
Container lab3-clean-api-2 Removing
|
||||
Container lab3-clean-api-2 Removed
|
||||
Container lab3-clean-valkey-1 Stopping
|
||||
Container lab3-clean-migrate-1 Stopping
|
||||
Container lab3-clean-migrate-1 Stopped
|
||||
Container lab3-clean-migrate-1 Removing
|
||||
Container lab3-clean-migrate-1 Removed
|
||||
Container lab3-clean-postgres-1 Stopping
|
||||
Container lab3-clean-postgres-1 Stopped
|
||||
Container lab3-clean-postgres-1 Removing
|
||||
Container lab3-clean-postgres-1 Removed
|
||||
Container lab3-clean-valkey-1 Stopped
|
||||
Container lab3-clean-valkey-1 Removing
|
||||
Container lab3-clean-valkey-1 Removed
|
||||
Volume lab3-clean_postgres_data Removing
|
||||
Network lab3-clean_edge Removing
|
||||
Network lab3-clean_backend Removing
|
||||
Volume lab3-clean_postgres_data Removed
|
||||
Network lab3-clean_edge Removed
|
||||
Network lab3-clean_backend Removed
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,482 @@
|
||||
{
|
||||
"mode": "rolling",
|
||||
"started": "2026-10-20T09:50:22+0300",
|
||||
"profile": {
|
||||
"workers": 4,
|
||||
"loop": "closed: POST message (retry same key until 201) + GET limit=1",
|
||||
"client_timeout_seconds": 5,
|
||||
"phases_seconds": {
|
||||
"before": 8,
|
||||
"outage": 10,
|
||||
"after": 8
|
||||
}
|
||||
},
|
||||
"runs": [
|
||||
{
|
||||
"scenario": "rolling update",
|
||||
"target_instance": null,
|
||||
"workers": 4,
|
||||
"events_seconds": {
|
||||
"action_start": 10.323,
|
||||
"action_end": 26.786,
|
||||
"end": 34.791
|
||||
},
|
||||
"instances_before": [
|
||||
"109172df7747",
|
||||
"f6e244c650a2"
|
||||
],
|
||||
"instances_after": [
|
||||
"500528cb388e",
|
||||
"de52b5578b6b"
|
||||
],
|
||||
"target_responses_while_stopped": null,
|
||||
"restored_replica_in_rotation_seconds": null,
|
||||
"instances_seen_from_action": {
|
||||
"109172df7747": [
|
||||
-10.3,
|
||||
14.813
|
||||
],
|
||||
"f6e244c650a2": [
|
||||
-10.296,
|
||||
8.226
|
||||
],
|
||||
"500528cb388e": [
|
||||
6.241,
|
||||
24.466
|
||||
],
|
||||
"de52b5578b6b": [
|
||||
13.791,
|
||||
24.468
|
||||
]
|
||||
},
|
||||
"phases": {
|
||||
"before": {
|
||||
"seconds": 10.323,
|
||||
"write": {
|
||||
"ok": 3687,
|
||||
"errors": 0,
|
||||
"ok_rps": 357.2,
|
||||
"latency_ms": {
|
||||
"p50": 5.4,
|
||||
"p95": 10.3,
|
||||
"p99": 28.9
|
||||
}
|
||||
},
|
||||
"read": {
|
||||
"ok": 3684,
|
||||
"errors": 0,
|
||||
"ok_rps": 356.9,
|
||||
"latency_ms": {
|
||||
"p50": 4.2,
|
||||
"p95": 7.8,
|
||||
"p99": 19.9
|
||||
}
|
||||
}
|
||||
},
|
||||
"during": {
|
||||
"seconds": 16.463,
|
||||
"write": {
|
||||
"ok": 5071,
|
||||
"errors": 0,
|
||||
"ok_rps": 308.0,
|
||||
"latency_ms": {
|
||||
"p50": 5.4,
|
||||
"p95": 16.9,
|
||||
"p99": 38.6
|
||||
}
|
||||
},
|
||||
"read": {
|
||||
"ok": 5073,
|
||||
"errors": 0,
|
||||
"ok_rps": 308.1,
|
||||
"latency_ms": {
|
||||
"p50": 4.2,
|
||||
"p95": 12.3,
|
||||
"p99": 31.4
|
||||
}
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"seconds": 8.005,
|
||||
"write": {
|
||||
"ok": 2800,
|
||||
"errors": 0,
|
||||
"ok_rps": 349.8,
|
||||
"latency_ms": {
|
||||
"p50": 4.8,
|
||||
"p95": 10.9,
|
||||
"p99": 48.3
|
||||
}
|
||||
},
|
||||
"read": {
|
||||
"ok": 2801,
|
||||
"errors": 0,
|
||||
"ok_rps": 349.9,
|
||||
"latency_ms": {
|
||||
"p50": 3.7,
|
||||
"p95": 8.0,
|
||||
"p99": 47.3
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"recovery": {
|
||||
"write_errors": 0,
|
||||
"error_kinds": {},
|
||||
"write_recovery_seconds": 0.0,
|
||||
"max_write_gap_seconds": 0.299
|
||||
},
|
||||
"integrity": {
|
||||
"messages_in_history": 11558,
|
||||
"confirmed_unique": 11558,
|
||||
"confirmed_missing_or_changed": 0,
|
||||
"duplicate_ids": 0,
|
||||
"duplicate_texts": 0,
|
||||
"retried_writes_confirmed_as_replay": 0
|
||||
},
|
||||
"container_stats_before_action": [
|
||||
"messenger-lab3-nginx-1\t10.92%\t3.227MiB / 64MiB",
|
||||
"messenger-lab3-postgres-1\t30.04%\t54.82MiB / 512MiB",
|
||||
"messenger-lab3-api-1\t85.53%\t52.1MiB / 512MiB",
|
||||
"messenger-lab3-api-2\t84.90%\t54.01MiB / 512MiB"
|
||||
],
|
||||
"action_output": [
|
||||
"[09:50:33] build revision exp-1792479022",
|
||||
"[09:50:34] migrate",
|
||||
"[09:50:36] scale api to 3, wait healthy",
|
||||
"[09:50:41] graceful stop messenger-lab3-api-1",
|
||||
"[09:50:42] scale api to 3, wait healthy",
|
||||
"[09:50:47] graceful stop messenger-lab3-api-2",
|
||||
"[09:50:49] done: all API replicas run revision exp-1792479022"
|
||||
],
|
||||
"restore_output_tail": [],
|
||||
"timeline": [
|
||||
{
|
||||
"t": 0,
|
||||
"ok": 705,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 354,
|
||||
"f6e244c650a2": 351
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 1,
|
||||
"ok": 522,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 263,
|
||||
"109172df7747": 259
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 2,
|
||||
"ok": 733,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 367,
|
||||
"f6e244c650a2": 366
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 3,
|
||||
"ok": 771,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 385,
|
||||
"f6e244c650a2": 386
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 4,
|
||||
"ok": 725,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 363,
|
||||
"f6e244c650a2": 362
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 5,
|
||||
"ok": 803,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 401,
|
||||
"f6e244c650a2": 402
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 6,
|
||||
"ok": 449,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 224,
|
||||
"f6e244c650a2": 225
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 7,
|
||||
"ok": 777,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 390,
|
||||
"f6e244c650a2": 387
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 8,
|
||||
"ok": 803,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 402,
|
||||
"109172df7747": 401
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 9,
|
||||
"ok": 811,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 405,
|
||||
"f6e244c650a2": 406
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 10,
|
||||
"ok": 677,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 339,
|
||||
"f6e244c650a2": 338
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 11,
|
||||
"ok": 271,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 135,
|
||||
"109172df7747": 136
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 12,
|
||||
"ok": 432,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 217,
|
||||
"109172df7747": 215
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 13,
|
||||
"ok": 422,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 211,
|
||||
"f6e244c650a2": 211
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 14,
|
||||
"ok": 533,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 267,
|
||||
"f6e244c650a2": 266
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 15,
|
||||
"ok": 737,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 369,
|
||||
"109172df7747": 368
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 16,
|
||||
"ok": 683,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 276,
|
||||
"f6e244c650a2": 277,
|
||||
"500528cb388e": 130
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 17,
|
||||
"ok": 635,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 212,
|
||||
"109172df7747": 212,
|
||||
"f6e244c650a2": 211
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 18,
|
||||
"ok": 841,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"f6e244c650a2": 153,
|
||||
"500528cb388e": 345,
|
||||
"109172df7747": 343
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 19,
|
||||
"ok": 782,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 391,
|
||||
"500528cb388e": 391
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 20,
|
||||
"ok": 254,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 128,
|
||||
"500528cb388e": 126
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 21,
|
||||
"ok": 767,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 384,
|
||||
"109172df7747": 383
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 22,
|
||||
"ok": 761,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 380,
|
||||
"500528cb388e": 381
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 23,
|
||||
"ok": 795,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 397,
|
||||
"109172df7747": 398
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 24,
|
||||
"ok": 924,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"109172df7747": 322,
|
||||
"500528cb388e": 321,
|
||||
"de52b5578b6b": 281
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 25,
|
||||
"ok": 681,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 320,
|
||||
"109172df7747": 41,
|
||||
"de52b5578b6b": 320
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 26,
|
||||
"ok": 232,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 115,
|
||||
"500528cb388e": 117
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 27,
|
||||
"ok": 252,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 126,
|
||||
"500528cb388e": 126
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 28,
|
||||
"ok": 633,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 317,
|
||||
"500528cb388e": 316
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 29,
|
||||
"ok": 940,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 470,
|
||||
"de52b5578b6b": 470
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 30,
|
||||
"ok": 814,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 407,
|
||||
"500528cb388e": 407
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 31,
|
||||
"ok": 626,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 313,
|
||||
"500528cb388e": 313
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 32,
|
||||
"ok": 878,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"de52b5578b6b": 439,
|
||||
"500528cb388e": 439
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 33,
|
||||
"ok": 740,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 370,
|
||||
"de52b5578b6b": 370
|
||||
}
|
||||
},
|
||||
{
|
||||
"t": 34,
|
||||
"ok": 707,
|
||||
"errors": 0,
|
||||
"instances": {
|
||||
"500528cb388e": 353,
|
||||
"de52b5578b6b": 354
|
||||
}
|
||||
}
|
||||
],
|
||||
"revisions_after": [
|
||||
"CONTAINER STATE INSTANCE PID REVISION",
|
||||
"messenger-lab3-api-3 running/healthy 500528cb388e 60335 exp-1792479022",
|
||||
"messenger-lab3-api-4 running/healthy de52b5578b6b 60779 exp-1792479022"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 3,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.024,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 21418,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 713.369,
|
||||
"successful_latency_ms": {
|
||||
"p50": 4.748,
|
||||
"p95": 8.395,
|
||||
"p99": 22.531
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
Reference in New Issue
Block a user