ЛР4: отчёт, MR и сырые доказательства проверок и экспериментов

This commit is contained in:
IvanMeln1k
2026-12-04 14:26:03 +03:00
parent f1fae32722
commit f23789d9f9
36 changed files with 4231 additions and 21 deletions
+15
View File
@@ -0,0 +1,15 @@
### attachment_checks
### command: make PYTHON=/usr/bin/python3 test-attachment
### started_at: 2026-12-04T11:20:46Z
/usr/bin/python3 student-tests/attachment-checks.py --base-url "http://127.0.0.1:8084"
PASS size and pixel limits
PASS MIME, damage and filename display
PASS filename validation
PASS attachment ACL
PASS interrupted upload leaves no row/object
PASS unavailable S3 is 503, not 500, and recovers
PASS unavailable PostgreSQL is 503, liveness stays up, data recovers
PASS no token/password/message/S3 secret in API logs
PASS: lab4 attachment checks, 39 assertions
### exit_code: 0
+22
View File
@@ -0,0 +1,22 @@
### container_checks
### command: make PYTHON=/usr/bin/python3 test-container
### started_at: 2026-12-04T11:21:34Z
/usr/bin/python3 scripts/container-checks.py --base-url "http://127.0.0.1:8084"
lab4 container checks at 2026-12-04T11:21:36.286068Z
result: PASS
git revision: f1fae32722dd89c48369ae92a303287c93490ed0
API replicas: 2 (b685ff3f08d3, c3f381c822ae)
API image ids: sha256:743995b25b1abba227d84d4e23f016e2121916cc68f4c032670eb8c24203314b
S3 image id: sha256:0513e5e469b80438fcb8961e4b7c422e782251114d4930ac17cd9fbe508ad5ba
API ports published: {'mtusi-lab4-melnikov-api-1': '', 'mtusi-lab4-melnikov-api-2': ''}
S3 ports published: ''
LB ports: 8080/tcp -> 127.0.0.1:8084
volumes: mtusi-lab4-melnikov-pgdata, mtusi-lab4-melnikov-s3data, mtusi-lab4-melnikov-valkeydata
limits: {"api":[{"name":"mtusi-lab4-melnikov-api-1","nano_cpus":500000000,"memory_bytes":402653184,"readonly_rootfs":true,"cap_drop":["ALL"],"security_opt":["no-new-privileges:true"],"user":"10001:10001","mounts":[],"volume_mounts":[]},{"name":"mtusi-lab4-melnikov-api-2","nano_cpus":500000000,"memory_bytes":402653184,"readonly_rootfs":true,"cap_drop":["ALL"],"security_opt":["no-new-privileges:true"],"user":"10001:10001","mounts":[],"volume_mounts":[]}],"postgres":[{"name":"mtusi-lab4-melnikov-postgres-1","nano_cpus":500000000,"memory_bytes":402653184,"readonly_rootfs":false,"cap_drop":null,"security_opt":["no-new-privileges:true"],"user":"","mounts":["mtusi-lab4-melnikov-pgdata"],"volume_mounts":["mtusi-lab4-melnikov-pgdata"]}],"valkey":[{"name":"mtusi-lab4-melnikov-valkey-1","nano_cpus":100000000,"memory_bytes":100663296,"readonly_rootfs":false,"cap_drop":null,"security_opt":["no-new-privileges:true"],"user":"","mounts":["mtusi-lab4-melnikov-valkeydata"],"volume_mounts":["mtusi-lab4-melnikov-valkeydata"]}],"s3":[{"name":"mtusi-lab4-melnikov-s3-1","nano_cpus":400000000,"memory_bytes":402653184,"readonly_rootfs":false,"cap_drop":null,"security_opt":["no-new-privileges:true"],"user":"","mounts":["/Users/ivanmuller/Desktop/oh_my_life/highload/lab4/infra/seaweedfs-s3.json","mtusi-lab4-melnikov-s3data"],"volume_mounts":["mtusi-lab4-melnikov-s3data"]}],"lb":[{"name":"mtusi-lab4-melnikov-lb-1","nano_cpus":200000000,"memory_bytes":67108864,"readonly_rootfs":true,"cap_drop":["ALL"],"security_opt":["no-new-privileges:true"],"user":"haproxy","mounts":["/Users/ivanmuller/Desktop/oh_my_life/highload/lab4/infra/haproxy.cfg"],"volume_mounts":[]}]}
observed session instances: b685ff3f08d3, c3f381c822ae
anonymous object GET denied: True
anonymous bucket list denied: True
bootstrap second run: exit=0 created_false=True
PASS: container, S3 privacy and credential checks
### exit_code: 0
+14
View File
@@ -0,0 +1,14 @@
started_at: 2026-12-04T11:20:34Z
base_url: http://127.0.0.1:8084
git_revision: f1fae32722dd89c48369ae92a303287c93490ed0
git_status_lines: 6
python3: Python 3.14.4
python39: Python 3.9.6
go: go version go1.25.1 darwin/arm64
docker_server: 27.4.0
docker_cpus_mem: CPUs=2 MemTotal=2054631424
api_images:
/mtusi-lab4-melnikov-api-1 image=sha256:743995b25b1abba227d84d4e23f016e2121916cc68f4c032670eb8c24203314b started=2026-12-04T11:20:31.647058664Z
/mtusi-lab4-melnikov-api-2 image=sha256:743995b25b1abba227d84d4e23f016e2121916cc68f4c032670eb8c24203314b started=2026-12-04T11:20:31.736803769Z
s3_image:
/mtusi-lab4-melnikov-s3-1 image=sha256:0513e5e469b80438fcb8961e4b7c422e782251114d4930ac17cd9fbe508ad5ba
+10
View File
@@ -0,0 +1,10 @@
### experiment
### command: make PYTHON=/usr/bin/python3 experiment
### started_at: 2026-12-04T11:24:35Z
/usr/bin/python3 scripts/upload-experiment.py --base-url "http://127.0.0.1:8084"
== restart API replicas to reset the process high-water mark ==
== generate the reproducible upload profile ==
{"result": "PASS", "observed_peak_concurrency": 12, "successful_uploads": 12, "wall_seconds": 1.025, "process_peak_sampled_rss_bytes": {"773413b3e9bd": 72986624, "9d9d4b6abf35": 27385856}, "process_final_hwm_bytes": {"773413b3e9bd": 74690560, "9d9d4b6abf35": 53465088}, "api_memory_limit_bytes": 402653184}
PASS: >=10 concurrent uploads with bounded API process RSS
### exit_code: 0
+9
View File
@@ -0,0 +1,9 @@
### failover_public
### command: make PYTHON=/usr/bin/python3 test-failover ACTION_SCRIPT=scripts/stop-one.sh
### started_at: 2026-12-04T11:23:22Z
/usr/bin/python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:8084"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 135, "failed_attempts": 0, "first_recovery_seconds": 3.205}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
### exit_code: 0
+7
View File
@@ -0,0 +1,7 @@
### failover_upload
### command: /usr/bin/python3 scripts/failover-upload.py --base-url http://127.0.0.1:8084
### started_at: 2026-12-04T11:23:42Z
{"upload_instance": "773413b3e9bd", "download_instance": "9d9d4b6abf35", "instances_seen": ["9d9d4b6abf35"], "sha256_matches": true, "stopped_container_state": "exited", "restored_at": "2026-12-04T11:23:46.540443Z"}
PASS: upload survived replica stop and downloaded with the same SHA-256 via another replica
### exit_code: 0
+21
View File
@@ -0,0 +1,21 @@
### go_race
### command: make PYTHON=/usr/bin/python3 test-student-race
### started_at: 2026-12-04T11:20:39Z
go test -race -count=1 ./...
? mtusi.ru/messenger-lab4/cmd/loadgen [no test files]
? mtusi.ru/messenger-lab4/cmd/messenger [no test files]
? mtusi.ru/messenger-lab4/cmd/migrate [no test files]
? mtusi.ru/messenger-lab4/cmd/reconciler [no test files]
? mtusi.ru/messenger-lab4/cmd/s3bootstrap [no test files]
? mtusi.ru/messenger-lab4/cmd/s3ctl [no test files]
ok mtusi.ru/messenger-lab4/internal/api 1.203s
ok mtusi.ru/messenger-lab4/internal/auth 4.034s
ok mtusi.ru/messenger-lab4/internal/config 1.783s
ok mtusi.ru/messenger-lab4/internal/cursor 1.299s
ok mtusi.ru/messenger-lab4/internal/model 1.419s
? mtusi.ru/messenger-lab4/internal/objectstore [no test files]
? mtusi.ru/messenger-lab4/internal/session [no test files]
ok mtusi.ru/messenger-lab4/internal/store 1.660s
ok mtusi.ru/messenger-lab4/internal/uuid 1.896s
### exit_code: 0
+36
View File
@@ -0,0 +1,36 @@
### go_tests
### command: make PYTHON=/usr/bin/python3 test-student
### started_at: 2026-12-04T11:20:35Z
go test -count=1 ./...
? mtusi.ru/messenger-lab4/cmd/loadgen [no test files]
? mtusi.ru/messenger-lab4/cmd/messenger [no test files]
? mtusi.ru/messenger-lab4/cmd/migrate [no test files]
? mtusi.ru/messenger-lab4/cmd/reconciler [no test files]
? mtusi.ru/messenger-lab4/cmd/s3bootstrap [no test files]
? mtusi.ru/messenger-lab4/cmd/s3ctl [no test files]
ok mtusi.ru/messenger-lab4/internal/api 0.336s
ok mtusi.ru/messenger-lab4/internal/auth 0.388s
ok mtusi.ru/messenger-lab4/internal/config 0.849s
ok mtusi.ru/messenger-lab4/internal/cursor 0.435s
ok mtusi.ru/messenger-lab4/internal/model 0.967s
? mtusi.ru/messenger-lab4/internal/objectstore [no test files]
? mtusi.ru/messenger-lab4/internal/session [no test files]
ok mtusi.ru/messenger-lab4/internal/store 0.552s
ok mtusi.ru/messenger-lab4/internal/uuid 1.080s
/usr/bin/python3 student-tests/blackbox.py --base-url "http://127.0.0.1:8084"
PASS health
PASS registration/auth
PASS registration validation
PASS chats/membership
PASS messages
PASS attachments and message links
PASS instances (2 observed)
PASS idempotency replay/conflict/scope/validation
PASS concurrent idempotency across 2 replicas
PASS pagination
PASS concurrent registration
PASS concurrent messages
PASS logout
PASS: lab4 student black-box suite, 149 checks
### exit_code: 0
+7
View File
@@ -0,0 +1,7 @@
### make_check
### command: make PYTHON=/usr/bin/python3 check
### started_at: 2026-12-04T11:20:35Z
/usr/bin/python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
### exit_code: 0
+9
View File
@@ -0,0 +1,9 @@
### make_validate
### command: make PYTHON=.venv/bin/python validate
### started_at: 2026-12-04T11:20:35Z
.venv/bin/python scripts/validate_openapi.py
/Users/ivanmuller/Desktop/oh_my_life/highload/lab4/.venv/lib/python3.9/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(
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
### exit_code: 0
@@ -0,0 +1,8 @@
### persistence_evidence
### command: /usr/bin/python3 scripts/persistence-evidence.py --base-url http://127.0.0.1:8084
### started_at: 2026-12-04T11:22:29Z
running scripts/restart.sh (all API replicas and used stores, volumes kept)
{"result": "PASS", "checks": {"same_container_ids": true, "started_at_changed": true, "all_services_restarted": true, "volumes_unchanged": true, "same_token_still_valid": true, "message_survived": true, "attachment_metadata_survived": true, "attachment_bytes_survived": true}}
PASS: real containers restarted, volumes and data preserved
### exit_code: 0
+8
View File
@@ -0,0 +1,8 @@
### persistence_public
### command: make PYTHON=/usr/bin/python3 test-persistence ACTION_SCRIPT=scripts/restart.sh
### started_at: 2026-12-04T11:21:36Z
/usr/bin/python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:8084"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
### exit_code: 0
+7
View File
@@ -0,0 +1,7 @@
### smoke
### command: make PYTHON=/usr/bin/python3 test
### started_at: 2026-12-04T11:20:44Z
/usr/bin/python3 tests/smoke.py --base-url "http://127.0.0.1:8084"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
### exit_code: 0
@@ -0,0 +1,7 @@
### smoke_after_experiment
### command: make PYTHON=/usr/bin/python3 test
### started_at: 2026-12-04T11:24:42Z
/usr/bin/python3 tests/smoke.py --base-url "http://127.0.0.1:8084"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
### exit_code: 0
+23
View File
@@ -0,0 +1,23 @@
### smoke_python39
### command: ./scripts/py39-tests.sh
### started_at: 2026-12-04T11:20:44Z
Python 3.9.6
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
PASS health
PASS registration/auth
PASS registration validation
PASS chats/membership
PASS messages
PASS attachments and message links
PASS instances (2 observed)
PASS idempotency replay/conflict/scope/validation
PASS concurrent idempotency across 2 replicas
PASS pagination
PASS concurrent registration
PASS concurrent messages
PASS logout
PASS: lab4 student black-box suite, 149 checks
PASS: Python 3.9 compilation, public smoke and student black-box suite
### exit_code: 0
+2
View File
@@ -0,0 +1,2 @@
finished_at: 2026-12-04T11:24:43Z
15 ### exit_code: 0
+16
View File
@@ -0,0 +1,16 @@
### track2
### command: make PYTHON=/usr/bin/python3 test-consistency
### started_at: 2026-12-04T11:23:48Z
/usr/bin/python3 scripts/track2.py --base-url "http://127.0.0.1:8084"
== reproducible base set ==
== cost of a clean traversal ==
== inject faults on both sides ==
== dry run: detection without mutation ==
== apply: only provable stale items ==
== rerun before grace expiry: no new deletions ==
== grace expiry: the fresh orphan is now old enough ==
== API and used attachments after reconciliation ==
{"result": "PASS", "assertions": 68, "failed": 0, "cost_ms_median": 10}
PASS: track 2 reconciler experiment
### exit_code: 0