forked from mtusi2026/mtusi2026lab3
Implement lab 3 replica failover and shared idempotency for grade 4
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,59 @@
|
||||
[
|
||||
{
|
||||
"name": "/mtusi-lab3-api-3",
|
||||
"id": "066038d89cfde897fa86e495a6a5da9ef5f034246ed24068126e61bfaa5b575f",
|
||||
"hostname": "066038d89cfd",
|
||||
"image": "mtusi-messenger:lab3",
|
||||
"nano_cpus": 500000000,
|
||||
"memory_bytes": 268435456,
|
||||
"published_ports": {},
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"name": "/mtusi-lab3-api-4",
|
||||
"id": "383e40bbffdbc40d6b1616ce3047113cd0b1e5485d119bbb6faf82f429636d51",
|
||||
"hostname": "383e40bbffdb",
|
||||
"image": "mtusi-messenger:lab3",
|
||||
"nano_cpus": 500000000,
|
||||
"memory_bytes": 268435456,
|
||||
"published_ports": {},
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"name": "/mtusi-lab3-lb-1",
|
||||
"id": "0a6d71637d552b19eeed1c4297aa4820e9c716de1834aa66dd069aa8c1bb0e12",
|
||||
"hostname": "0a6d71637d55",
|
||||
"image": "haproxy:3.0.5-alpine",
|
||||
"nano_cpus": 500000000,
|
||||
"memory_bytes": 134217728,
|
||||
"published_ports": {
|
||||
"8080/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8080"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"name": "/mtusi-lab3-postgres-1",
|
||||
"id": "7ca801989874fd05198a44e8766306706bb5bcde897b117c4be80c67d63dda17",
|
||||
"hostname": "7ca801989874",
|
||||
"image": "postgres:16.6-bookworm",
|
||||
"nano_cpus": 1000000000,
|
||||
"memory_bytes": 536870912,
|
||||
"published_ports": {},
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"name": "/mtusi-lab3-valkey-1",
|
||||
"id": "1c38b117111eb5e0e46338828bd03fc02d851548dce91f52332f4c000658a43b",
|
||||
"hostname": "1c38b117111e",
|
||||
"image": "valkey/valkey:8.0.2-alpine",
|
||||
"nano_cpus": 250000000,
|
||||
"memory_bytes": 134217728,
|
||||
"published_ports": {},
|
||||
"status": "running"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
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": 116, "failed_attempts": 2, "first_recovery_seconds": 1.682}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,72 @@
|
||||
Container mtusi-lab3-api-2 Running
|
||||
Container mtusi-lab3-api-3 Creating
|
||||
Container mtusi-lab3-api-3 Created
|
||||
Container mtusi-lab3-api-3 Starting
|
||||
Container mtusi-lab3-api-3 Started
|
||||
Container mtusi-lab3-api-3 Running
|
||||
Container mtusi-lab3-api-4 Creating
|
||||
Container mtusi-lab3-api-4 Created
|
||||
Container mtusi-lab3-api-4 Starting
|
||||
Container mtusi-lab3-api-4 Started
|
||||
{
|
||||
"parallel_idempotency": {
|
||||
"requests": 16,
|
||||
"instances": [
|
||||
"5b0b704c3534",
|
||||
"7c17ba154623"
|
||||
],
|
||||
"messages": 1
|
||||
},
|
||||
"failures": [
|
||||
{
|
||||
"duration_seconds": 7.974,
|
||||
"successful_write_read_pairs": 699,
|
||||
"successful_pairs_rps": 87.66,
|
||||
"errors": 24,
|
||||
"first_success_after_action_seconds": 0.997,
|
||||
"max_success_gap_seconds": 1.051,
|
||||
"action_seconds": 0.926,
|
||||
"containers": {
|
||||
"stopped": "7c17ba154623ae02d42f50ff1c64b391c7487a45e9cc90f8535a9e98801a2f99",
|
||||
"hostname": "7c17ba154623",
|
||||
"running": false
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
},
|
||||
{
|
||||
"duration_seconds": 7.459,
|
||||
"successful_write_read_pairs": 610,
|
||||
"successful_pairs_rps": 81.78,
|
||||
"errors": 25,
|
||||
"first_success_after_action_seconds": 0.999,
|
||||
"max_success_gap_seconds": 1.055,
|
||||
"action_seconds": 0.421,
|
||||
"containers": {
|
||||
"stopped": "5b0b704c3534d18e438338ed89290ac8bc7636ad8abf492833548e385d2ffd19",
|
||||
"hostname": "5b0b704c3534",
|
||||
"running": false
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
}
|
||||
],
|
||||
"rolling": {
|
||||
"duration_seconds": 28.603,
|
||||
"successful_write_read_pairs": 2834,
|
||||
"successful_pairs_rps": 99.08,
|
||||
"errors": 50,
|
||||
"first_success_after_action_seconds": 0.013,
|
||||
"max_success_gap_seconds": 1.025,
|
||||
"action_seconds": 21.55,
|
||||
"containers": {
|
||||
"old_containers": [
|
||||
"7c17ba154623ae02d42f50ff1c64b391c7487a45e9cc90f8535a9e98801a2f99",
|
||||
"5b0b704c3534d18e438338ed89290ac8bc7636ad8abf492833548e385d2ffd19"
|
||||
],
|
||||
"new_containers": [
|
||||
"066038d89cfde897fa86e495a6a5da9ef5f034246ed24068126e61bfaa5b575f",
|
||||
"383e40bbffdbc40d6b1616ce3047113cd0b1e5485d119bbb6faf82f429636d51"
|
||||
]
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"parallel_idempotency": {
|
||||
"requests": 16,
|
||||
"instances": [
|
||||
"5b0b704c3534",
|
||||
"7c17ba154623"
|
||||
],
|
||||
"messages": 1
|
||||
},
|
||||
"failures": [
|
||||
{
|
||||
"duration_seconds": 7.974,
|
||||
"successful_write_read_pairs": 699,
|
||||
"successful_pairs_rps": 87.66,
|
||||
"errors": 24,
|
||||
"first_success_after_action_seconds": 0.997,
|
||||
"max_success_gap_seconds": 1.051,
|
||||
"action_seconds": 0.926,
|
||||
"containers": {
|
||||
"stopped": "7c17ba154623ae02d42f50ff1c64b391c7487a45e9cc90f8535a9e98801a2f99",
|
||||
"hostname": "7c17ba154623",
|
||||
"running": false
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
},
|
||||
{
|
||||
"duration_seconds": 7.459,
|
||||
"successful_write_read_pairs": 610,
|
||||
"successful_pairs_rps": 81.78,
|
||||
"errors": 25,
|
||||
"first_success_after_action_seconds": 0.999,
|
||||
"max_success_gap_seconds": 1.055,
|
||||
"action_seconds": 0.421,
|
||||
"containers": {
|
||||
"stopped": "5b0b704c3534d18e438338ed89290ac8bc7636ad8abf492833548e385d2ffd19",
|
||||
"hostname": "5b0b704c3534",
|
||||
"running": false
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
}
|
||||
],
|
||||
"rolling": {
|
||||
"duration_seconds": 28.603,
|
||||
"successful_write_read_pairs": 2834,
|
||||
"successful_pairs_rps": 99.08,
|
||||
"errors": 50,
|
||||
"first_success_after_action_seconds": 0.013,
|
||||
"max_success_gap_seconds": 1.025,
|
||||
"action_seconds": 21.55,
|
||||
"containers": {
|
||||
"old_containers": [
|
||||
"7c17ba154623ae02d42f50ff1c64b391c7487a45e9cc90f8535a9e98801a2f99",
|
||||
"5b0b704c3534d18e438338ed89290ac8bc7636ad8abf492833548e385d2ffd19"
|
||||
],
|
||||
"new_containers": [
|
||||
"066038d89cfde897fa86e495a6a5da9ef5f034246ed24068126e61bfaa5b575f",
|
||||
"383e40bbffdbc40d6b1616ce3047113cd0b1e5485d119bbb6faf82f429636d51"
|
||||
]
|
||||
},
|
||||
"confirmed_messages_preserved": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Container mtusi-lab3-postgres-1 Running
|
||||
Container mtusi-lab3-postgres-1 Waiting
|
||||
Container mtusi-lab3-postgres-1 Healthy
|
||||
Container mtusi-lab3-migrate-run-d2961d8a585a Creating
|
||||
Container mtusi-lab3-migrate-run-d2961d8a585a Created
|
||||
Migrations OK
|
||||
@@ -0,0 +1,3 @@
|
||||
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.
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"/mtusi-lab3-api-3": {
|
||||
"before": "2026-11-12T19:02:20.076228592Z",
|
||||
"after": "2026-11-12T19:03:15.056269715Z",
|
||||
"changed": true
|
||||
},
|
||||
"/mtusi-lab3-api-4": {
|
||||
"before": "2026-11-12T19:02:29.221614722Z",
|
||||
"after": "2026-11-12T19:03:15.067598256Z",
|
||||
"changed": true
|
||||
},
|
||||
"/mtusi-lab3-lb-1": {
|
||||
"before": "2026-11-12T19:01:18.778681508Z",
|
||||
"after": "2026-11-12T19:03:14.902540756Z",
|
||||
"changed": true
|
||||
},
|
||||
"/mtusi-lab3-postgres-1": {
|
||||
"before": "2026-11-12T19:01:09.981673754Z",
|
||||
"after": "2026-11-12T19:03:14.91825534Z",
|
||||
"changed": true
|
||||
},
|
||||
"/mtusi-lab3-valkey-1": {
|
||||
"before": "2026-11-12T19:01:10.057038421Z",
|
||||
"after": "2026-11-12T19:03:14.933475131Z",
|
||||
"changed": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,4 @@
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
/Users/sleepy13/Documents/Codex/2026-11-12/referenced-chatgpt-conversation-this-is-an/outputs/mtusi2026lab3/.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.
|
||||
Reference in New Issue
Block a user