Реализовать лабораторную работу 2
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
$ docker compose --env-file .env config --quiet
|
||||
|
||||
exit_code=0
|
||||
@@ -0,0 +1,25 @@
|
||||
$ docker compose --env-file .env down
|
||||
Container mtusi-lab2-api-1 Stopping
|
||||
Container mtusi-lab2-api-1 Stopped
|
||||
Container mtusi-lab2-api-1 Removing
|
||||
Container mtusi-lab2-api-1 Removed
|
||||
Container mtusi-lab2-postgres-1 Stopping
|
||||
Container mtusi-lab2-redis-1 Stopping
|
||||
Container mtusi-lab2-postgres-1 Stopped
|
||||
Container mtusi-lab2-postgres-1 Removing
|
||||
Container mtusi-lab2-postgres-1 Removed
|
||||
Container mtusi-lab2-redis-1 Stopped
|
||||
Container mtusi-lab2-redis-1 Removing
|
||||
Container mtusi-lab2-redis-1 Removed
|
||||
Network mtusi-lab2_default Removing
|
||||
Network mtusi-lab2_default Removed
|
||||
|
||||
$ docker compose --env-file .env ps -a
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
|
||||
$ docker volume ls --filter name=mtusi-lab2
|
||||
DRIVER VOLUME NAME
|
||||
local mtusi-lab2_postgres_data
|
||||
local mtusi-lab2_redis_data
|
||||
|
||||
PASS: containers stopped; named volumes retained.
|
||||
@@ -0,0 +1,10 @@
|
||||
chat_id=[synthetic-uuid]; messages_in_fixture=10000
|
||||
Limit (cost=0.41..17.85 rows=50 width=70) (actual time=0.013..0.022 rows=50 loops=1)
|
||||
Buffers: shared hit=6
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.41..3506.77 rows=10057 width=70) (actual time=0.013..0.019 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = '[synthetic-uuid]'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '[synthetic-uuid]'::uuid)))
|
||||
Buffers: shared hit=6
|
||||
Planning:
|
||||
Buffers: shared hit=20
|
||||
Planning Time: 0.215 ms
|
||||
Execution Time: 0.066 ms
|
||||
@@ -0,0 +1,5 @@
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
|
||||
exit_code=0
|
||||
@@ -0,0 +1,126 @@
|
||||
$ make test-grade4
|
||||
./scripts/test-grade4.sh
|
||||
Image mtusi-lab2-api Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 549B 0.1s done
|
||||
#1 DONE 0.1s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile:
|
||||
#2 transferring dockerfile: 426B 0.0s done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [auth] library/python:pull token for registry-1.docker.io
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load metadata for docker.io/library/python:3.12.8-slim
|
||||
#4 DONE 1.0s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 196B 0.0s done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [1/8] FROM docker.io/library/python:3.12.8-slim@sha256:2199a62885a12290dc9c5be3ca0681d367576ab7bf037da120e564723292a2f0
|
||||
#6 resolve docker.io/library/python:3.12.8-slim@sha256:2199a62885a12290dc9c5be3ca0681d367576ab7bf037da120e564723292a2f0 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [internal] load build context
|
||||
#7 transferring context: 3.87kB 0.0s done
|
||||
#7 DONE 0.1s
|
||||
|
||||
#8 [4/8] RUN pip install --no-cache-dir -r requirements-app.txt
|
||||
#8 CACHED
|
||||
|
||||
#9 [5/8] COPY app ./app
|
||||
#9 CACHED
|
||||
|
||||
#10 [2/8] WORKDIR /app
|
||||
#10 CACHED
|
||||
|
||||
#11 [3/8] COPY requirements-app.txt ./
|
||||
#11 CACHED
|
||||
|
||||
#12 [6/8] COPY migrations ./migrations
|
||||
#12 CACHED
|
||||
|
||||
#13 [7/8] COPY scripts ./scripts
|
||||
#13 DONE 0.0s
|
||||
|
||||
#14 [8/8] RUN useradd --create-home --uid 10001 appuser
|
||||
#14 DONE 0.2s
|
||||
|
||||
#15 exporting to image
|
||||
#15 exporting layers 0.1s done
|
||||
#15 exporting manifest sha256:9cf6afdb1a8794e290a56671c9efc636477b8be3f83fa4b6774ea411e5b45272 0.0s done
|
||||
#15 exporting config sha256:095cc9895237f2b980d61820984491b10ee450d6ac5b9f7e2679edb1c3ab6b0d 0.0s done
|
||||
#15 exporting attestation manifest sha256:fa617bc26cb86a65a6dfd8525c4a7746266dc27f8310b60816894a9de1a0fbaa
|
||||
#15 exporting attestation manifest sha256:fa617bc26cb86a65a6dfd8525c4a7746266dc27f8310b60816894a9de1a0fbaa 0.0s done
|
||||
#15 exporting manifest list sha256:19627d8186b8193cce2b9ad8bd761bb4c1c704f92c6f9a73309528a29ca6cc9c 0.0s done
|
||||
#15 naming to docker.io/library/mtusi-lab2-api:latest done
|
||||
#15 unpacking to docker.io/library/mtusi-lab2-api:latest 0.0s done
|
||||
#15 DONE 0.2s
|
||||
|
||||
#16 resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
Image mtusi-lab2-api Built
|
||||
Network mtusi-lab2_default Creating
|
||||
Network mtusi-lab2_default Creating
|
||||
Network mtusi-lab2_default Created
|
||||
Network mtusi-lab2_default Created
|
||||
Container mtusi-lab2-postgres-1 Creating
|
||||
Container mtusi-lab2-redis-1 Creating
|
||||
Container mtusi-lab2-redis-1 Created
|
||||
Container mtusi-lab2-postgres-1 Created
|
||||
Container mtusi-lab2-api-1 Creating
|
||||
Container mtusi-lab2-api-1 Created
|
||||
Container mtusi-lab2-postgres-1 Starting
|
||||
Container mtusi-lab2-redis-1 Starting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-redis-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Healthy
|
||||
Container mtusi-lab2-redis-1 Healthy
|
||||
Container mtusi-lab2-api-1 Starting
|
||||
Container mtusi-lab2-api-1 Started
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
PASS: concurrent username registration (1 x 201, 7 x 409)
|
||||
PASS: invalid password returns 401
|
||||
PASS: failed chat creation rolled back chat and memberships
|
||||
PASS: Redis outage returns bounded 503 for readiness and session creation; service recovers
|
||||
PASS: PostgreSQL outage returns bounded 503 for readiness and registration; service recovers
|
||||
PASS: Redis session expires at the original short TTL
|
||||
Container mtusi-lab2-redis-1 Running
|
||||
Container mtusi-lab2-postgres-1 Running
|
||||
Container mtusi-lab2-api-1 Recreate
|
||||
Container mtusi-lab2-api-1 Recreated
|
||||
Container mtusi-lab2-redis-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-redis-1 Healthy
|
||||
Container mtusi-lab2-postgres-1 Healthy
|
||||
Container mtusi-lab2-api-1 Starting
|
||||
Container mtusi-lab2-api-1 Started
|
||||
chat_id=[synthetic-uuid]; messages_in_fixture=10000
|
||||
Limit (cost=0.41..17.85 rows=50 width=70) (actual time=0.013..0.022 rows=50 loops=1)
|
||||
Buffers: shared hit=6
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.41..3506.77 rows=10057 width=70) (actual time=0.013..0.019 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = '[synthetic-uuid]'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '[synthetic-uuid]'::uuid)))
|
||||
Buffers: shared hit=6
|
||||
Planning:
|
||||
Buffers: shared hit=20
|
||||
Planning Time: 0.215 ms
|
||||
Execution Time: 0.066 ms
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
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.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
|
||||
exit_code=0
|
||||
@@ -0,0 +1,5 @@
|
||||
$ make validate PYTHON=.venv/bin/python
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
|
||||
exit_code=0
|
||||
@@ -0,0 +1,37 @@
|
||||
$ make test-grade4
|
||||
PASS: exit_code=0; details are in make-test-grade4.txt
|
||||
|
||||
$ docker compose --env-file .env ps (before restart)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 12 seconds ago Up 6 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 35 seconds ago Up 6 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 35 seconds ago Up 6 seconds (healthy) 6379/tcp
|
||||
|
||||
$ docker inspect --format name + StartedAt + health (before restart)
|
||||
/mtusi-lab2-api-1 2026-10-18T12:02:22.47421812Z healthy
|
||||
/mtusi-lab2-postgres-1 2026-10-18T12:02:22.265638383Z healthy
|
||||
/mtusi-lab2-redis-1 2026-10-18T12:02:22.37541571Z healthy
|
||||
|
||||
$ scripts/restart.sh
|
||||
Container mtusi-lab2-api-1 Restarting
|
||||
Container mtusi-lab2-redis-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-api-1 Started
|
||||
|
||||
$ curl -fsS http://localhost:8080/health/ready
|
||||
{"status":"ok"}
|
||||
|
||||
$ docker inspect --format name + StartedAt + health (after restart)
|
||||
/mtusi-lab2-api-1 2026-10-18T12:02:30.372421246Z healthy
|
||||
/mtusi-lab2-postgres-1 2026-10-18T12:02:30.172148956Z healthy
|
||||
/mtusi-lab2-redis-1 2026-10-18T12:02:30.269554196Z healthy
|
||||
|
||||
$ docker compose --env-file .env ps (after restart)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 21 seconds ago Up 7 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 44 seconds ago Up 7 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 44 seconds ago Up 7 seconds (healthy) 6379/tcp
|
||||
|
||||
exit_code=0
|
||||
@@ -0,0 +1,167 @@
|
||||
=== Lab2 verification evidence ===
|
||||
Date (UTC):
|
||||
2026-10-14
|
||||
Local date (Europe/Moscow): 2026-10-15
|
||||
Working tree base commit:
|
||||
65003b61195361aac238f19c9bff0027ca58e09e
|
||||
Working-tree note: implementation is uncommitted; no commit created.
|
||||
Runtime:
|
||||
Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 GNU/Linux
|
||||
Visible WSL CPU count:
|
||||
32
|
||||
Visible WSL memory:
|
||||
MemTotal: 16209628 kB
|
||||
|
||||
Docker engine resources:
|
||||
CPUs=32, memory_bytes=16598659072
|
||||
Profile: 8-way concurrent same-username registration; API smoke; TTL=2s expiry; Redis/PostgreSQL outage and recovery; 10,000-message EXPLAIN. No sustained load/throughput benchmark.
|
||||
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
|
||||
$ docker compose --env-file .env config --quiet
|
||||
PASS: Compose configuration
|
||||
|
||||
$ make test-grade4
|
||||
./scripts/test-grade4.sh
|
||||
Image mtusi-lab2-api Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 480B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 426B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/python:3.12.8-slim
|
||||
#3 ...
|
||||
|
||||
#4 [auth] library/python:pull token for registry-1.docker.io
|
||||
#4 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/python:3.12.8-slim
|
||||
#3 DONE 2.9s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 196B done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [1/8] FROM docker.io/library/python:3.12.8-slim@sha256:2199a62885a12290dc9c5be3ca0681d367576ab7bf037da120e564723292a2f0
|
||||
#6 resolve docker.io/library/python:3.12.8-slim@sha256:2199a62885a12290dc9c5be3ca0681d367576ab7bf037da120e564723292a2f0 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [internal] load build context
|
||||
#7 transferring context: 4.45kB done
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [4/8] RUN pip install --no-cache-dir -r requirements-app.txt
|
||||
#8 CACHED
|
||||
|
||||
#9 [5/8] COPY app ./app
|
||||
#9 CACHED
|
||||
|
||||
#10 [2/8] WORKDIR /app
|
||||
#10 CACHED
|
||||
|
||||
#11 [3/8] COPY requirements-app.txt ./
|
||||
#11 CACHED
|
||||
|
||||
#12 [6/8] COPY migrations ./migrations
|
||||
#12 CACHED
|
||||
|
||||
#13 [7/8] COPY scripts ./scripts
|
||||
#13 DONE 0.0s
|
||||
|
||||
#14 [8/8] RUN useradd --create-home --uid 10001 appuser
|
||||
#14 DONE 0.3s
|
||||
|
||||
#15 exporting to image
|
||||
#15 exporting layers 0.1s done
|
||||
#15 exporting manifest sha256:e41af12501ce06d0c4226798c7361c3d246c6e05dd58cc92e685b938cb461196 done
|
||||
#15 exporting config sha256:88794e51c3f243a681401fdc72656dd5fd7eaec008e67a9d328cd5fc993c0a31 done
|
||||
#15 exporting attestation manifest sha256:e7691318b06a958c64a7b7b736070b037e3830d44301ffd63b7b3f856d13bb87
|
||||
#15 exporting attestation manifest sha256:e7691318b06a958c64a7b7b736070b037e3830d44301ffd63b7b3f856d13bb87 0.0s done
|
||||
#15 exporting manifest list sha256:2f914bb85d5987a05b55998905a8f70789c90c99e76d38632d4111b31fc9eef9 0.0s done
|
||||
#15 naming to docker.io/library/mtusi-lab2-api:latest done
|
||||
#15 unpacking to docker.io/library/mtusi-lab2-api:latest 0.0s done
|
||||
#15 DONE 0.2s
|
||||
|
||||
#16 resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
Image mtusi-lab2-api Built
|
||||
Container mtusi-lab2-postgres-1 Running
|
||||
Container mtusi-lab2-redis-1 Running
|
||||
Container mtusi-lab2-api-1 Recreate
|
||||
Container mtusi-lab2-api-1 Recreated
|
||||
Container mtusi-lab2-redis-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-redis-1 Healthy
|
||||
Container mtusi-lab2-postgres-1 Healthy
|
||||
Container mtusi-lab2-api-1 Starting
|
||||
Container mtusi-lab2-api-1 Started
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
PASS: concurrent username registration (1 x 201, 7 x 409)
|
||||
PASS: invalid password returns 401
|
||||
PASS: failed chat creation rolled back chat and memberships
|
||||
PASS: Redis outage returns bounded 503 for readiness and session creation; service recovers
|
||||
PASS: PostgreSQL outage returns bounded 503 for readiness and registration; service recovers
|
||||
PASS: Redis session expires at the original short TTL
|
||||
Container mtusi-lab2-postgres-1 Running
|
||||
Container mtusi-lab2-redis-1 Running
|
||||
Container mtusi-lab2-api-1 Recreate
|
||||
Container mtusi-lab2-api-1 Recreated
|
||||
Container mtusi-lab2-redis-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-redis-1 Healthy
|
||||
Container mtusi-lab2-postgres-1 Healthy
|
||||
Container mtusi-lab2-api-1 Starting
|
||||
Container mtusi-lab2-api-1 Started
|
||||
chat_id=[synthetic-uuid]; messages_in_fixture=10000
|
||||
Limit (cost=0.41..9.56 rows=50 width=70) (actual time=0.012..0.018 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.41..1830.33 rows=9997 width=70) (actual time=0.011..0.015 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = '[synthetic-uuid]'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '[synthetic-uuid]'::uuid)))
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=18
|
||||
Planning Time: 0.098 ms
|
||||
Execution Time: 0.057 ms
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
make[1]: Entering directory '/home/lenovo/lab2'
|
||||
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.
|
||||
make[1]: Leaving directory '/home/lenovo/lab2'
|
||||
|
||||
=== Restart-hook evidence ===
|
||||
2026-10-15T01:30:19+03:00
|
||||
$ docker compose --env-file .env ps (before)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 59 seconds ago Up 53 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 6 hours ago Up 53 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 6 hours ago Up 53 seconds (healthy) 6379/tcp
|
||||
$ scripts/restart.sh
|
||||
Container mtusi-lab2-postgres-1 Restarting
|
||||
Container mtusi-lab2-redis-1 Restarting
|
||||
Container mtusi-lab2-api-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-api-1 Started
|
||||
$ docker compose --env-file .env ps (after)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api About a minute ago Up Less than a second (health: starting) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 6 hours ago Up Less than a second (health: starting) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 6 hours ago Up Less than a second (health: starting) 6379/tcp
|
||||
$ docker compose --env-file .env ps (after readiness)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api About a minute ago Up 22 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 6 hours ago Up 22 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 6 hours ago Up 22 seconds (healthy) 6379/tcp
|
||||
{"status":"ok"}
|
||||
@@ -0,0 +1,207 @@
|
||||
=== Lab2 final verification ===
|
||||
Date (Europe/Moscow): 2026-10-18
|
||||
Date (UTC): 2026-10-18T11:50:18Z
|
||||
HEAD commit: 65003b61195361aac238f19c9bff0027ca58e09e
|
||||
Working tree: implementation changes are uncommitted; no commit created.
|
||||
WSL runtime: Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 GNU/Linux
|
||||
WSL visible CPUs: 32
|
||||
WSL visible memory: 16209624 kB
|
||||
Docker engine resources: CPUs=32 memory_bytes=16598654976
|
||||
Docker Compose version v5.5.1
|
||||
Profile: make check; full OpenAPI/schema validation; Compose config; grade-4 suite (8-way username race, invalid password, transaction rollback, Redis/PostgreSQL outage and recovery, 2-second session expiry, 10k-message EXPLAIN); public smoke; persistence with restart of API/PostgreSQL/Redis; manual restart-hook state check. No sustained load benchmark.
|
||||
Hardware limits: WSL/Docker visible resource caps above; no additional per-container CPU/RAM limits configured.
|
||||
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
exit_code=0
|
||||
|
||||
$ make validate PYTHON=.venv/bin/python
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
exit_code=0
|
||||
|
||||
$ docker compose --env-file .env config --quiet
|
||||
PASS: Compose configuration
|
||||
exit_code=0
|
||||
|
||||
$ make test-grade4
|
||||
Selected sanitized stdout (build lifecycle details omitted):
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
PASS: concurrent username registration (1 x 201, 7 x 409)
|
||||
PASS: invalid password returns 401
|
||||
PASS: failed chat creation rolled back chat and memberships
|
||||
PASS: Redis outage returns bounded 503 for readiness and session creation; service recovers
|
||||
PASS: PostgreSQL outage returns bounded 503 for readiness and registration; service recovers
|
||||
PASS: Redis session expires at the original short TTL
|
||||
chat_id=[synthetic-uuid]; messages_in_fixture=10000
|
||||
Buffers: shared hit=6
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.41..2834.08 rows=9994 width=70) (actual time=0.011..0.017 rows=50 loops=1)
|
||||
Buffers: shared hit=6
|
||||
Buffers: shared hit=18
|
||||
Planning Time: 0.102 ms
|
||||
Execution Time: 0.056 ms
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit_code=0
|
||||
|
||||
$ docker compose --env-file .env ps (before manual restart hook)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 8 seconds ago Up 1 second (health: starting) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 31 seconds ago Up 1 second (health: starting) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 31 seconds ago Up 1 second (health: starting) 6379/tcp
|
||||
|
||||
$ docker inspect --format name + StartedAt (before restart)
|
||||
/mtusi-lab2-api-1 2026-10-18T11:51:04.236364497Z
|
||||
/mtusi-lab2-postgres-1 2026-10-18T11:51:04.031258233Z
|
||||
/mtusi-lab2-redis-1 2026-10-18T11:51:04.167666161Z
|
||||
|
||||
$ scripts/restart.sh
|
||||
Container mtusi-lab2-redis-1 Restarting
|
||||
Container mtusi-lab2-api-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-api-1 Started
|
||||
{"status":"ok"}
|
||||
|
||||
$ docker inspect --format name + StartedAt (after restart and ready)
|
||||
/mtusi-lab2-api-1 2026-10-18T11:51:06.539804958Z
|
||||
/mtusi-lab2-postgres-1 2026-10-18T11:51:06.356125844Z
|
||||
/mtusi-lab2-redis-1 2026-10-18T11:51:06.47135391Z
|
||||
|
||||
$ docker compose --env-file .env ps (after restart and readiness)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 11 seconds ago Up 1 second (health: starting) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 34 seconds ago Up 1 second (health: starting) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 34 seconds ago Up 1 second (health: starting) 6379/tcp
|
||||
|
||||
$ docker compose --env-file .env down (named volumes preserved)
|
||||
Container mtusi-lab2-api-1 Stopping
|
||||
Container mtusi-lab2-api-1 Stopped
|
||||
Container mtusi-lab2-api-1 Removing
|
||||
Container mtusi-lab2-api-1 Removed
|
||||
Container mtusi-lab2-postgres-1 Stopping
|
||||
Container mtusi-lab2-redis-1 Stopping
|
||||
Container mtusi-lab2-postgres-1 Stopped
|
||||
Container mtusi-lab2-postgres-1 Removing
|
||||
Container mtusi-lab2-postgres-1 Removed
|
||||
Container mtusi-lab2-redis-1 Stopped
|
||||
Container mtusi-lab2-redis-1 Removing
|
||||
Container mtusi-lab2-redis-1 Removed
|
||||
Network mtusi-lab2_default Removing
|
||||
Network mtusi-lab2_default Removed
|
||||
|
||||
$ docker compose --env-file .env ps -a
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
PASS: lab containers stopped; named data volumes retained.
|
||||
|
||||
=== Healthy-state follow-up for restart-hook evidence ===
|
||||
Date (UTC): 2026-10-18T11:52:14Z
|
||||
|
||||
$ docker compose --env-file .env up -d
|
||||
Network mtusi-lab2_default Creating
|
||||
Network mtusi-lab2_default Creating
|
||||
Network mtusi-lab2_default Created
|
||||
Network mtusi-lab2_default Created
|
||||
Container mtusi-lab2-postgres-1 Creating
|
||||
Container mtusi-lab2-redis-1 Creating
|
||||
Container mtusi-lab2-redis-1 Created
|
||||
Container mtusi-lab2-postgres-1 Created
|
||||
Container mtusi-lab2-api-1 Creating
|
||||
Container mtusi-lab2-api-1 Created
|
||||
Container mtusi-lab2-postgres-1 Starting
|
||||
Container mtusi-lab2-redis-1 Starting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-redis-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-postgres-1 Healthy
|
||||
Container mtusi-lab2-redis-1 Healthy
|
||||
Container mtusi-lab2-api-1 Starting
|
||||
Container mtusi-lab2-api-1 Started
|
||||
|
||||
$ docker compose ps (before restart; all health checks healthy)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 13 seconds ago Up 6 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 13 seconds ago Up 12 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 13 seconds ago Up 12 seconds (healthy) 6379/tcp
|
||||
|
||||
$ docker inspect --format service + StartedAt + health (before restart)
|
||||
/mtusi-lab2-api-1 2026-10-18T11:52:20.370835549Z healthy
|
||||
/mtusi-lab2-postgres-1 2026-10-18T11:52:15.020176217Z healthy
|
||||
/mtusi-lab2-redis-1 2026-10-18T11:52:15.201648026Z healthy
|
||||
|
||||
$ scripts/restart.sh
|
||||
Container mtusi-lab2-api-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Restarting
|
||||
Container mtusi-lab2-redis-1 Restarting
|
||||
Container mtusi-lab2-postgres-1 Started
|
||||
Container mtusi-lab2-redis-1 Started
|
||||
Container mtusi-lab2-api-1 Started
|
||||
|
||||
$ curl -fsS http://localhost:8080/health/ready
|
||||
{"status":"ok"}
|
||||
|
||||
$ docker inspect --format service + StartedAt + health (after restart)
|
||||
/mtusi-lab2-api-1 2026-10-18T11:52:28.711942433Z healthy
|
||||
/mtusi-lab2-postgres-1 2026-10-18T11:52:28.537174473Z healthy
|
||||
/mtusi-lab2-redis-1 2026-10-18T11:52:28.647499479Z healthy
|
||||
|
||||
$ docker compose ps (after restart; all health checks healthy)
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab2-api-1 mtusi-lab2-api "uvicorn app.main:ap…" api 22 seconds ago Up 7 seconds (healthy) 127.0.0.1:8080->8080/tcp
|
||||
mtusi-lab2-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 22 seconds ago Up 7 seconds (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab2-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 22 seconds ago Up 7 seconds (healthy) 6379/tcp
|
||||
|
||||
$ docker compose --env-file .env down (named volumes preserved)
|
||||
Container mtusi-lab2-api-1 Stopping
|
||||
Container mtusi-lab2-api-1 Stopped
|
||||
Container mtusi-lab2-api-1 Removing
|
||||
Container mtusi-lab2-api-1 Removed
|
||||
Container mtusi-lab2-redis-1 Stopping
|
||||
Container mtusi-lab2-postgres-1 Stopping
|
||||
Container mtusi-lab2-redis-1 Stopped
|
||||
Container mtusi-lab2-redis-1 Removing
|
||||
Container mtusi-lab2-redis-1 Removed
|
||||
Container mtusi-lab2-postgres-1 Stopped
|
||||
Container mtusi-lab2-postgres-1 Removing
|
||||
Container mtusi-lab2-postgres-1 Removed
|
||||
Network mtusi-lab2_default Removing
|
||||
Network mtusi-lab2_default Removed
|
||||
|
||||
$ docker compose --env-file .env ps -a
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
PASS: lab containers stopped; named data volumes retained.
|
||||
|
||||
=== Post-edit final checks ===
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
|
||||
$ make validate PYTHON=.venv/bin/python
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
|
||||
$ git diff --check (initial attempt)
|
||||
Detected a trailing CR on the newly added README command line; corrected that line ending.
|
||||
|
||||
$ git check-ignore .env
|
||||
.env
|
||||
PASS: local .env is ignored
|
||||
|
||||
=== Final post-fix verification ===
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
|
||||
$ make validate PYTHON=.venv/bin/python
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
|
||||
$ git diff --check
|
||||
PASS: no whitespace errors after correction
|
||||
|
||||
$ git check-ignore .env
|
||||
.env
|
||||
PASS: local .env is ignored
|
||||
@@ -0,0 +1,13 @@
|
||||
Lab 2 verification run
|
||||
Local date: 2026-10-18
|
||||
UTC date: 2026-10-18T12:01:49Z
|
||||
Base commit: 65003b61195361aac238f19c9bff0027ca58e09e
|
||||
Working tree: local implementation is uncommitted.
|
||||
Runtime: Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 GNU/Linux
|
||||
Visible WSL CPU count: 32
|
||||
Visible WSL memory: 16209624 kB
|
||||
Docker engine resources: CPUs=32 memory_bytes=16598654976
|
||||
Docker Compose version v5.5.1
|
||||
Profile: make check, OpenAPI/JSON Schema validation, Compose config, grade-4 test suite, EXPLAIN with 10,000 synthetic messages, smoke, persistence with restart hook, healthy-state restart evidence.
|
||||
No sustained load benchmark was run. No per-container CPU/RAM limits are configured.
|
||||
Session tokens, credentials, and raw message bodies are not part of these evidence files.
|
||||
Reference in New Issue
Block a user