docs(evidence): add test and failure evidence for levels 3 and 4

This commit is contained in:
kk10
2026-10-20 13:22:09 +03:00
parent 9cfe15ef1a
commit 9784fe9d14
6 changed files with 239 additions and 0 deletions
+125
View File
@@ -0,0 +1,125 @@
> docker compose up -d --wait
[+] up 7/7
✔ Network mtusi2026lab3_default Created 0.0s
✔ Container mtusi2026lab3-redis-1 Healthy 13.1s
✔ Container mtusi2026lab3-postgres-1 Healthy 13.1s
✔ Container mtusi2026lab3-migrate-1 Exited 12.9s
✔ Container mtusi2026lab3-api-2 Healthy 12.9s
✔ Container mtusi2026lab3-api-1 Healthy 12.9s
✔ Container mtusi2026lab3-load_balancer-1 Healthy 12.7s
> docker compose ps -a api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api 15 seconds ago Up 7 seconds (healthy) 8080/tcp
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api 15 seconds ago Up 7 seconds (healthy) 8080/tcp
> make load-action-go LOAD_DURATION=30s REPLICA=1 ACTION_AT=10s
go test -tags=load,action ./student-tests/... -run TestLoadWithAction -v -args \
-base-url=http://localhost:8080 -duration=30s \
-replica=1 \
-action=/mnt/c/Users/kamywek10/Documents/Gitea/mtusi2026lab3/scripts/stop-one.sh \
-action-at=10s
=== RUN TestLoadWithAction
load_action_test.go:139: t= 0s ok= 380 err= 0
load_action_test.go:139: t= 1s ok= 400 err= 0
load_action_test.go:139: t= 2s ok= 400 err= 0
load_action_test.go:139: t= 3s ok= 400 err= 0
load_action_test.go:139: t= 4s ok= 400 err= 0
load_action_test.go:139: t= 5s ok= 400 err= 0
load_action_test.go:139: t= 6s ok= 400 err= 0
load_action_test.go:139: t= 7s ok= 400 err= 0
load_action_test.go:139: t= 8s ok= 400 err= 0
load_action_test.go:139: t= 9s ok= 400 err= 0
load_action_test.go:139: t=10s ok= 103 err= 0
load_action_test.go:139: t=11s ok= 314 err= 0
load_action_test.go:139: t=12s ok= 400 err= 0
load_action_test.go:139: t=13s ok= 400 err= 0
load_action_test.go:139: t=14s ok= 400 err= 0
load_action_test.go:139: t=15s ok= 400 err= 0
load_action_test.go:139: t=16s ok= 400 err= 0
load_action_test.go:139: t=17s ok= 400 err= 0
load_action_test.go:139: t=18s ok= 400 err= 0
load_action_test.go:139: t=19s ok= 400 err= 0
load_action_test.go:139: t=20s ok= 400 err= 0
load_action_test.go:139: t=21s ok= 400 err= 0
load_action_test.go:139: t=22s ok= 400 err= 0
load_action_test.go:139: t=23s ok= 400 err= 0
load_action_test.go:139: t=24s ok= 400 err= 0
load_action_test.go:139: t=25s ok= 400 err= 0
load_action_test.go:139: t=26s ok= 400 err= 0
load_action_test.go:139: t=27s ok= 400 err= 0
load_action_test.go:139: t=28s ok= 400 err= 0
load_action_test.go:139: t=29s ok= 400 err= 0
load_action_test.go:139: t=30s ok= 0 err= 0
load_action_test.go:142: action: started at 10.00s, finished at 10.47s
load_action_test.go:143: total ok=11597 errors=0, successful RPS=386.56
load_action_test.go:146: recovery time: 0s (no errors after action start)
--- PASS: TestLoadWithAction (30.43s)
PASS
ok mtusi2026-messenger/student-tests 30.436s
> docker compose ps -a api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api 53 seconds ago Exited (0) 23 seconds ago
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api 53 seconds ago Up 46 seconds (healthy) 8080/tcp
> docker compose up -d --wait
[+] up 6/6
✔ Container mtusi2026lab3-postgres-1 Healthy 7.0s
✔ Container mtusi2026lab3-redis-1 Healthy 7.0s
✔ Container mtusi2026lab3-load_balancer-1 Healthy 7.0s
✔ Container mtusi2026lab3-api-2 Healthy 7.0s
✔ Container mtusi2026lab3-migrate-1 Exited 6.4s
✔ Container mtusi2026lab3-api-1 Healthy 5.7s
> make load-action-go LOAD_DURATION=30s REPLICA=2 ACTION_AT=10s
go test -tags=load,action ./student-tests/... -run TestLoadWithAction -v -args \
-base-url=http://localhost:8080 -duration=30s \
-replica=2 \
-action=/mnt/c/Users/kamywek10/Documents/Gitea/mtusi2026lab3/scripts/stop-one.sh \
-action-at=10s
=== RUN TestLoadWithAction
load_action_test.go:139: t= 0s ok= 380 err= 0
load_action_test.go:139: t= 1s ok= 400 err= 0
load_action_test.go:139: t= 2s ok= 400 err= 0
load_action_test.go:139: t= 3s ok= 400 err= 0
load_action_test.go:139: t= 4s ok= 400 err= 0
load_action_test.go:139: t= 5s ok= 400 err= 0
load_action_test.go:139: t= 6s ok= 400 err= 0
load_action_test.go:139: t= 7s ok= 400 err= 0
load_action_test.go:139: t= 8s ok= 400 err= 0
load_action_test.go:139: t= 9s ok= 400 err= 0
load_action_test.go:139: t=10s ok= 161 err= 0
load_action_test.go:139: t=11s ok= 259 err= 0
load_action_test.go:139: t=12s ok= 400 err= 0
load_action_test.go:139: t=13s ok= 400 err= 0
load_action_test.go:139: t=14s ok= 400 err= 0
load_action_test.go:139: t=15s ok= 400 err= 0
load_action_test.go:139: t=16s ok= 400 err= 0
load_action_test.go:139: t=17s ok= 400 err= 0
load_action_test.go:139: t=18s ok= 400 err= 0
load_action_test.go:139: t=19s ok= 400 err= 0
load_action_test.go:139: t=20s ok= 400 err= 0
load_action_test.go:139: t=21s ok= 400 err= 0
load_action_test.go:139: t=22s ok= 400 err= 0
load_action_test.go:139: t=23s ok= 400 err= 0
load_action_test.go:139: t=24s ok= 400 err= 0
load_action_test.go:139: t=25s ok= 400 err= 0
load_action_test.go:139: t=26s ok= 400 err= 0
load_action_test.go:139: t=27s ok= 400 err= 0
load_action_test.go:139: t=28s ok= 400 err= 0
load_action_test.go:139: t=29s ok= 400 err= 0
load_action_test.go:139: t=30s ok= 0 err= 0
load_action_test.go:142: action: started at 10.00s, finished at 10.52s
load_action_test.go:143: total ok=11600 errors=0, successful RPS=386.66
load_action_test.go:146: recovery time: 0s (no errors after action start)
--- PASS: TestLoadWithAction (30.34s)
PASS
ok mtusi2026-messenger/student-tests 30.348s
> docker compose ps -a api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api About a minute ago Up 42 seconds (healthy) 8080/tcp
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api About a minute ago Exited (0) 23 seconds ago
> docker compose up -d --wait
[+] up 6/6
✔ Container mtusi2026lab3-redis-1 Healthy 7.0s
✔ Container mtusi2026lab3-load_balancer-1 Healthy 7.0s
✔ Container mtusi2026lab3-api-1 Healthy 7.0s
✔ Container mtusi2026lab3-postgres-1 Healthy 7.0s
✔ Container mtusi2026lab3-migrate-1 Exited 6.5s
✔ Container mtusi2026lab3-api-2 Healthy 5.8s
+12
View File
@@ -0,0 +1,12 @@
> make race-go
go test -tags=race ./student-tests/... -race -v -args -base-url=http://localhost:8080
=== RUN TestConcurrentIdempotencyAcrossReplicas
idempotency_test.go:134: served by replicas: map[11898d10b97b:{} 511daa3c1c74:{}]
--- PASS: TestConcurrentIdempotencyAcrossReplicas (0.44s)
=== RUN TestConcurrentMessages
race_test.go:98: PASS: 10 concurrent clients sent 100 messages, exactly 100 unique messages persisted
--- PASS: TestConcurrentMessages (0.39s)
=== RUN TestConcurrentRegistration
--- PASS: TestConcurrentRegistration (0.99s)
PASS
ok mtusi2026-messenger/student-tests 2.829s
+13
View File
@@ -0,0 +1,13 @@
> docker compose ps -a api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api 16 minutes ago Up 16 minutes (healthy) 8080/tcp
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api 16 minutes ago Up 16 minutes (healthy) 8080/tcp
> 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": 123, "failed_attempts": 0, "first_recovery_seconds": 1.324}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
> docker compose ps -a api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api 17 minutes ago Exited (0) 16 seconds ago
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api 17 minutes ago Up 16 minutes (healthy) 8080/tcp
+4
View File
@@ -0,0 +1,4 @@
> 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.
+3
View File
@@ -0,0 +1,3 @@
> make test
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
+82
View File
@@ -0,0 +1,82 @@
> docker compose ps api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-1 mtusi-messenger:lab3 "/app/server" api 17 seconds ago Up 9 seconds (healthy) 8080/tcp
mtusi2026lab3-api-2 mtusi-messenger:lab3 "/app/server" api 17 seconds ago Up 9 seconds (healthy) 8080/tcp
> make load-action-go ACTION=rolling-update.sh LOAD_DURATION=60s ACTION_AT=10s
go test -tags=load,action ./student-tests/... -run TestLoadWithAction -v -args \
-base-url=http://localhost:8080 -duration=60s \
-replica=1 \
-action=/mnt/c/Users/kamywek10/Documents/Gitea/mtusi2026lab3/scripts/rolling-update.sh \
-action-at=10s
=== RUN TestLoadWithAction
load_action_test.go:139: t= 0s ok= 380 err= 0
load_action_test.go:139: t= 1s ok= 400 err= 0
load_action_test.go:139: t= 2s ok= 400 err= 0
load_action_test.go:139: t= 3s ok= 400 err= 0
load_action_test.go:139: t= 4s ok= 400 err= 0
load_action_test.go:139: t= 5s ok= 400 err= 0
load_action_test.go:139: t= 6s ok= 400 err= 0
load_action_test.go:139: t= 7s ok= 400 err= 0
load_action_test.go:139: t= 8s ok= 400 err= 0
load_action_test.go:139: t= 9s ok= 400 err= 0
load_action_test.go:139: t=10s ok= 400 err= 0
load_action_test.go:139: t=11s ok= 399 err= 0
load_action_test.go:139: t=12s ok= 401 err= 0
load_action_test.go:139: t=13s ok= 400 err= 0
load_action_test.go:139: t=14s ok= 400 err= 0
load_action_test.go:139: t=15s ok= 400 err= 0
load_action_test.go:139: t=16s ok= 400 err= 0
load_action_test.go:139: t=17s ok= 400 err= 0
load_action_test.go:139: t=18s ok= 400 err= 0
load_action_test.go:139: t=19s ok= 400 err= 0
load_action_test.go:139: t=20s ok= 400 err= 0
load_action_test.go:139: t=21s ok= 189 err= 0
load_action_test.go:139: t=22s ok= 250 err= 0
load_action_test.go:139: t=23s ok= 400 err= 0
load_action_test.go:139: t=24s ok= 400 err= 0
load_action_test.go:139: t=25s ok= 400 err= 0
load_action_test.go:139: t=26s ok= 400 err= 0
load_action_test.go:139: t=27s ok= 400 err= 0
load_action_test.go:139: t=28s ok= 400 err= 0
load_action_test.go:139: t=29s ok= 400 err= 0
load_action_test.go:139: t=30s ok= 47 err= 0
load_action_test.go:139: t=31s ok= 60 err= 0
load_action_test.go:139: t=32s ok= 333 err= 0
load_action_test.go:139: t=33s ok= 400 err= 0
load_action_test.go:139: t=34s ok= 400 err= 0
load_action_test.go:139: t=35s ok= 400 err= 0
load_action_test.go:139: t=36s ok= 400 err= 0
load_action_test.go:139: t=37s ok= 400 err= 0
load_action_test.go:139: t=38s ok= 400 err= 0
load_action_test.go:139: t=39s ok= 400 err= 0
load_action_test.go:139: t=40s ok= 400 err= 0
load_action_test.go:139: t=41s ok= 400 err= 0
load_action_test.go:139: t=42s ok= 400 err= 0
load_action_test.go:139: t=43s ok= 400 err= 0
load_action_test.go:139: t=44s ok= 400 err= 0
load_action_test.go:139: t=45s ok= 400 err= 0
load_action_test.go:139: t=46s ok= 400 err= 0
load_action_test.go:139: t=47s ok= 400 err= 0
load_action_test.go:139: t=48s ok= 400 err= 0
load_action_test.go:139: t=49s ok= 400 err= 0
load_action_test.go:139: t=50s ok= 400 err= 0
load_action_test.go:139: t=51s ok= 400 err= 0
load_action_test.go:139: t=52s ok= 400 err= 0
load_action_test.go:139: t=53s ok= 400 err= 0
load_action_test.go:139: t=54s ok= 400 err= 0
load_action_test.go:139: t=55s ok= 400 err= 0
load_action_test.go:139: t=56s ok= 400 err= 0
load_action_test.go:139: t=57s ok= 400 err= 0
load_action_test.go:139: t=58s ok= 400 err= 0
load_action_test.go:139: t=59s ok= 400 err= 0
load_action_test.go:139: t=60s ok= 0 err= 0
load_action_test.go:142: action: started at 10.00s, finished at 30.30s
load_action_test.go:143: total ok=22859 errors=0, successful RPS=380.98
load_action_test.go:146: recovery time: 0s (no errors after action start)
--- PASS: TestLoadWithAction (60.44s)
PASS
ok mtusi2026-messenger/student-tests 60.443s
> docker compose ps api
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi2026lab3-api-3 mtusi-messenger:lab3 "/app/server" api 50 seconds ago Up 49 seconds (healthy) 8080/tcp
mtusi2026lab3-api-4 mtusi-messenger:lab3 "/app/server" api 42 seconds ago Up 41 seconds (healthy) 8080/tcp