ЛР 2 — БВТ2303 — Брезгунова — на 5

This commit is contained in:
2026-10-22 13:28:45 +03:00
parent 65003b6119
commit 9ac1762101
31 changed files with 3387 additions and 37 deletions
+81
View File
@@ -0,0 +1,81 @@
Image mtusi-messenger:lab2 Building
#1 [internal] load local bake definitions
#1 reading from stdin 573B 0.1s done
#1 DONE 0.1s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 419B 0.0s done
#2 DONE 0.0s
#3 [auth] library/golang:pull token for registry-1.docker.io
#3 DONE 0.0s
#4 [auth] library/alpine:pull token for registry-1.docker.io
#4 DONE 0.0s
#5 [internal] load metadata for docker.io/library/golang:1.24.7-alpine3.22
#5 ...
#6 [internal] load metadata for docker.io/library/alpine:3.22.1
#6 DONE 1.0s
#5 [internal] load metadata for docker.io/library/golang:1.24.7-alpine3.22
#5 DONE 1.1s
#7 [internal] load .dockerignore
#7 transferring context: 216B done
#7 DONE 0.0s
#8 [build 1/7] FROM docker.io/library/golang:1.24.7-alpine3.22@sha256:fc2cff6625f3c1c92e6c85938ac5bd09034ad0d4bc2dfb08278020b68540dbb5
#8 resolve docker.io/library/golang:1.24.7-alpine3.22@sha256:fc2cff6625f3c1c92e6c85938ac5bd09034ad0d4bc2dfb08278020b68540dbb5 0.1s done
#8 DONE 0.1s
#9 [stage-1 1/3] FROM docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
#9 resolve docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 0.1s done
#9 DONE 0.1s
#10 [internal] load build context
#10 transferring context: 58.65kB 0.0s done
#10 DONE 0.0s
#11 [build 2/7] WORKDIR /src
#11 CACHED
#12 [build 3/7] COPY go.mod go.sum ./
#12 CACHED
#13 [build 4/7] RUN go mod download
#13 CACHED
#14 [build 5/7] COPY . .
#14 DONE 0.1s
#15 [build 6/7] RUN go test ./... && go vet ./...
#15 14.10 ok mtusi2026lab2 0.237s
#15 14.10 ? mtusi2026lab2/models [no test files]
#15 DONE 15.9s
#16 [build 7/7] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/messenger .
#16 DONE 12.7s
#17 [stage-1 2/3] RUN addgroup -S app && adduser -S -G app app
#17 CACHED
#18 [stage-1 3/3] COPY --from=build /out/messenger /usr/local/bin/messenger
#18 DONE 0.1s
#19 exporting to image
#19 exporting layers
#19 exporting layers 0.6s done
#19 exporting manifest sha256:e8c811054d3254708949e94dcb384e201823a951dfb50590c69df24fdc7586a0 0.0s done
#19 exporting config sha256:8ed4ff1295869d76d500ce5a74c63c939d1ca103d72fd643d9e9d2714fcf6324 0.0s done
#19 exporting attestation manifest sha256:368d2846dd6d36cc83b3d7607dc5a9cea986cfe8ecd7d2085b2e64f4c9bec07e 0.0s done
#19 exporting manifest list sha256:4561c35282d7c428edfa00f1f12a04c21c70ca2eaa0b1a462d4e1d9fc69ab764 0.0s done
#19 naming to docker.io/library/mtusi-messenger:lab2
#19 naming to docker.io/library/mtusi-messenger:lab2 done
#19 unpacking to docker.io/library/mtusi-messenger:lab2 0.1s done
#19 DONE 0.9s
#20 resolving provenance for metadata file
#20 DONE 0.0s
Image mtusi-messenger:lab2 Built
+25
View File
@@ -0,0 +1,25 @@
{
"registration_race": [
409,
409,
409,
201
],
"rollback": "PASS: chat and membership inserts rolled back",
"credential_storage": "Argon2id; 32-byte session digests",
"contract_edges": "PASS: cursor scope, no sender spoof, 128 Unicode password characters including colon",
"redis_down": {
"fallback": "PASS",
"seconds": 0.329
},
"cache_loss": "PASS: cache rebuild; original session/data valid",
"postgres_down": {
"protected_request": 503,
"readiness": 503,
"liveness": 200,
"seconds": 4.011
},
"migration_replay": "PASS: same migration/user/message counts",
"expiry": "PASS: SESSION_TTL_SECONDS=2 rejects existing token after expiry",
"logout": "PASS: revoked token rejected"
}
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 2,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 30.0,
"elapsed_seconds": 30.065,
"concurrency": 4,
"successful_requests": 8904,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 296.157,
"successful_latency_ms": {
"p50": 5.602,
"p95": 30.814,
"p99": 119.181
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
File diff suppressed because it is too large Load Diff
+237
View File
@@ -0,0 +1,237 @@
{
"sampled_at_utc": "2026-10-22T10:26:34.875518+00:00",
"command": "python tests/load.py --base-url http://127.0.0.1:8080 --duration 30 --concurrency 4 --output evidence/load.json",
"exit_code": 0,
"stdout": "{\n \"lab\": 2,\n \"workload\": \"closed-loop POST messages; no automatic retries\",\n \"requested_duration_seconds\": 30.0,\n \"elapsed_seconds\": 30.065,\n \"concurrency\": 4,\n \"successful_requests\": 8904,\n \"failed_requests\": 0,\n \"error_ratio\": 0.0,\n \"successful_rps\": 296.157,\n \"successful_latency_ms\": {\n \"p50\": 5.602,\n \"p95\": 30.814,\n \"p99\": 119.181\n },\n \"note\": \"Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead.\"\n}",
"stderr": "",
"samples": [
{
"seconds": 2.516,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "71.77%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "14.88%",
"MemUsage": "76.17MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "26.4MB / 31.1MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 187MB",
"CPUPerc": "53.25%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "16.52%",
"MemUsage": "84.58MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "19.8MB / 15.7MB",
"PIDs": "10"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "0.34%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "3.03%",
"MemUsage": "3.879MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
},
{
"seconds": 7.661,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "37.50%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "19.40%",
"MemUsage": "99.31MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "29.5MB / 34.9MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 200MB",
"CPUPerc": "40.26%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "16.88%",
"MemUsage": "86.4MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "22.1MB / 17.5MB",
"PIDs": "11"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "2.75%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "3.03%",
"MemUsage": "3.879MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
},
{
"seconds": 12.737,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "42.46%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "2.44%",
"MemUsage": "12.48MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "33.4MB / 39.4MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 212MB",
"CPUPerc": "41.65%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "17.25%",
"MemUsage": "88.34MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "24MB / 19MB",
"PIDs": "12"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "0.34%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "3.08%",
"MemUsage": "3.938MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
},
{
"seconds": 17.838,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "15.68%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "2.25%",
"MemUsage": "11.51MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "35.1MB / 41.5MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 223MB",
"CPUPerc": "12.26%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "16.77%",
"MemUsage": "85.88MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "25.9MB / 20.5MB",
"PIDs": "11"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "0.28%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "3.35%",
"MemUsage": "4.293MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
},
{
"seconds": 22.904,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "14.09%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "2.30%",
"MemUsage": "11.78MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "36.2MB / 42.7MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 227MB",
"CPUPerc": "34.57%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "16.89%",
"MemUsage": "86.49MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "26.5MB / 21MB",
"PIDs": "11"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "0.34%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "2.84%",
"MemUsage": "3.629MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
},
{
"seconds": 27.971,
"containers": [
{
"BlockIO": "0B / 0B",
"CPUPerc": "51.72%",
"Container": "7a8813e9a5256badf4587e977fa252bed25ab8f7263d8eaabd0b5439873dcb46",
"ID": "7a8813e9a525",
"MemPerc": "2.55%",
"MemUsage": "13.05MiB / 512MiB",
"Name": "mtusi-lab2-api-1",
"NetIO": "39MB / 46MB",
"PIDs": "14"
},
{
"BlockIO": "11.2MB / 236MB",
"CPUPerc": "55.88%",
"Container": "1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be",
"ID": "1543f104c8a8",
"MemPerc": "16.93%",
"MemUsage": "86.68MiB / 512MiB",
"Name": "mtusi-lab2-postgres-1",
"NetIO": "27.9MB / 22.2MB",
"PIDs": "11"
},
{
"BlockIO": "0B / 0B",
"CPUPerc": "0.39%",
"Container": "1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853",
"ID": "1e84e689b424",
"MemPerc": "3.03%",
"MemUsage": "3.879MiB / 128MiB",
"Name": "mtusi-lab2-redis-1",
"NetIO": "6.38kB / 1.57kB",
"PIDs": "6"
}
]
}
]
}
+60
View File
@@ -0,0 +1,60 @@
{
"timestamp_utc": "2026-10-22T10:24:03.697760+00:00",
"host": "Windows-11-10.0.26200-SP0",
"base_url": "http://127.0.0.1:8080",
"checks": [
{
"command": "scripts/check_contract.py",
"exit_code": 0,
"seconds": 0.106,
"stdout": "PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.",
"stderr": ""
},
{
"command": "tests/smoke.py --base-url http://127.0.0.1:8080",
"exit_code": 0,
"seconds": 0.829,
"stdout": "PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.",
"stderr": ""
},
{
"command": "tests/resilience.py --mode persistence --action-script scripts/restart.cmd --base-url http://127.0.0.1:8080",
"exit_code": 0,
"seconds": 5.869,
"stdout": "Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.\nPASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.",
"stderr": ""
},
{
"command": "student-tests/integration.py",
"exit_code": 0,
"seconds": 19.568,
"stdout": "PASS: races, rollback, KDF, cache hit/loss/outage, DB outage, migration replay, expiry, logout",
"stderr": ""
},
{
"command": "student-tests/research.py",
"exit_code": 0,
"seconds": 27.163,
"stdout": "PASS: 100000 messages, two indexes/read-write measurements, backup restored to new database with matching content\n{\"read_middle_ms\": {\"chat_only\": 8.986, \"keyset\": 0.097}, \"restore_seconds\": 0.779}",
"stderr": ""
},
{
"command": "tests/load.py --base-url http://127.0.0.1:8080 --duration 30 --concurrency 4 --output evidence/load.json",
"exit_code": 0,
"seconds": 30.647,
"stdout": "{\n \"lab\": 2,\n \"workload\": \"closed-loop POST messages; no automatic retries\",\n \"requested_duration_seconds\": 30.0,\n \"elapsed_seconds\": 30.135,\n \"concurrency\": 4,\n \"successful_requests\": 15594,\n \"failed_requests\": 0,\n \"error_ratio\": 0.0,\n \"successful_rps\": 517.47,\n \"successful_latency_ms\": {\n \"p50\": 4.73,\n \"p95\": 24.602,\n \"p99\": 29.299\n },\n \"note\": \"Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead.\"\n}",
"stderr": ""
}
],
"restart_before": [
"\"/mtusi-lab2-api-1\" \"848d079a208b3cfc9983752a913cf731e723739703108ebc5e46f8a47c2cca8d\" \"2026-10-22T10:23:03.052015698Z\" \"running\"",
"\"/mtusi-lab2-postgres-1\" \"1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be\" \"2026-10-22T10:22:46.693936115Z\" \"running\"",
"\"/mtusi-lab2-redis-1\" \"1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853\" \"2026-10-22T10:22:46.359922669Z\" \"running\""
],
"restart_after": [
"\"/mtusi-lab2-api-1\" \"848d079a208b3cfc9983752a913cf731e723739703108ebc5e46f8a47c2cca8d\" \"2026-10-22T10:24:10.361747033Z\" \"running\"",
"\"/mtusi-lab2-postgres-1\" \"1543f104c8a8e6c5f198f5b942014c0e5ef95bf627210975c01d7f36b76cc7be\" \"2026-10-22T10:24:06.279071946Z\" \"running\"",
"\"/mtusi-lab2-redis-1\" \"1e84e689b4244d86e68d64e517d57a2548955aa2739db83146c3d302833bb853\" \"2026-10-22T10:24:06.140891322Z\" \"running\""
],
"restart_scope_verified": true
}