add code for level 4

This commit is contained in:
Матвей
2026-10-14 15:25:51 +03:00
parent 6e7b8007ac
commit 516bb095ac
11 changed files with 175 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 0.559}
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 0.567}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
After the hook, `docker compose ps` showed api-b running and api-a stopped. api-a was then started and reached health=healthy.
+1 -1
View File
@@ -1,6 +1,6 @@
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 0.545}
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 0.765}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
After the hook, `docker compose ps` showed api-a running and api-b stopped. api-b was then started and reached health=healthy.
+5
View File
@@ -0,0 +1,5 @@
$ docker inspect --format '{{.Name}} cpu_nano={{.HostConfig.NanoCpus}} memory_bytes={{.HostConfig.Memory}}' <containers>
/mtusi2026lab3-api-a-1 cpu_nano=500000000 memory_bytes=268435456
/mtusi2026lab3-api-b-1 cpu_nano=500000000 memory_bytes=268435456
/mtusi2026lab3-postgres-1 cpu_nano=750000000 memory_bytes=536870912
/mtusi2026lab3-load_balancer-1 cpu_nano=250000000 memory_bytes=134217728
+4
View File
@@ -0,0 +1,4 @@
$ make test-rolling
python3 student-tests/rolling_update.py --base-url "http://localhost:8080"
{"instances_before": 2, "instances_after": 2, "successful_writes": 380, "failed_writes": 0, "elapsed_seconds": 12.239, "successful_rps": 31.048, "successful_latency_ms": {"p50": 6.288, "p95": 12.973, "p99": 55.053}}
PASS: sequential API replacement preserved writes through load balancer