feat: add 5 experiment
This commit is contained in:
@@ -0,0 +1,453 @@
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
docker compose --project-name highload-lab3 --env-file .env -f compose.yml --profile test run --build --rm backend-tests
|
||||
Container highload-lab3-db-1 Running
|
||||
Container highload-lab3-redis-1 Running
|
||||
Image highload-lab3-backend-tests Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 629B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 661B 0.0s done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/golang:1.22.2-bookworm
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load .dockerignore
|
||||
#4 transferring context: 33B
|
||||
#4 transferring context: 268B 0.0s done
|
||||
#4 DONE 0.2s
|
||||
|
||||
#5 [builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
|
||||
#5 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.0s done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [internal] load build context
|
||||
#6 transferring context: 2.49kB 0.2s done
|
||||
#6 DONE 0.2s
|
||||
|
||||
#7 [builder 2/6] WORKDIR /src
|
||||
#7 CACHED
|
||||
|
||||
#8 [builder 3/6] COPY go.mod go.sum ./
|
||||
#8 CACHED
|
||||
|
||||
#9 [builder 4/6] RUN go mod download
|
||||
#9 CACHED
|
||||
|
||||
#10 [builder 5/6] COPY backend ./backend
|
||||
#10 CACHED
|
||||
|
||||
#11 [builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
|
||||
#11 CACHED
|
||||
|
||||
#12 exporting to image
|
||||
#12 exporting layers
|
||||
#12 exporting layers 10.9s done
|
||||
#12 exporting manifest sha256:4bd45c73a0da989b49052aa8050de520bf58aec57ea4df0596741bae3c1224d7 0.0s done
|
||||
#12 exporting config sha256:37436eaab83b2bd6086c7f26cc412f7df6ae3d992339866ca29907f65fd1e477 0.0s done
|
||||
#12 exporting attestation manifest sha256:41e8f1268bdd0593e88c8643aaff71be090ba4958657225440a14f8a665cdec0 0.0s done
|
||||
#12 exporting manifest list sha256:afe26f12e4b9e826438564039760304347620cc5ce2ac6fe2822e916955e6884 0.0s done
|
||||
#12 naming to docker.io/library/highload-lab3-backend-tests:latest
|
||||
#12 naming to docker.io/library/highload-lab3-backend-tests:latest done
|
||||
#12 unpacking to docker.io/library/highload-lab3-backend-tests:latest
|
||||
#12 unpacking to docker.io/library/highload-lab3-backend-tests:latest 3.5s done
|
||||
#12 DONE 14.6s
|
||||
|
||||
#13 resolving provenance for metadata file
|
||||
#13 DONE 0.0s
|
||||
Image highload-lab3-backend-tests Built
|
||||
Container highload-lab3-redis-1 Waiting
|
||||
Container highload-lab3-db-1 Waiting
|
||||
Container highload-lab3-db-1 Healthy
|
||||
Container highload-lab3-redis-1 Healthy
|
||||
Container highload-lab3-backend-tests-run-5686bbb150cd Creating
|
||||
Container highload-lab3-backend-tests-run-5686bbb150cd Created
|
||||
? messenger/src/backend [no test files]
|
||||
? messenger/src/backend/handlers [no test files]
|
||||
? messenger/src/backend/repositories [no test files]
|
||||
? messenger/src/backend/services [no test files]
|
||||
=== RUN TestConcurrentMessageCreation
|
||||
--- PASS: TestConcurrentMessageCreation (4.08s)
|
||||
=== RUN TestConcurrentRegistrationSameUsername
|
||||
--- PASS: TestConcurrentRegistrationSameUsername (2.54s)
|
||||
=== RUN TestChatTransactionRollsBackAfterMemberInsertFailure
|
||||
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (1.37s)
|
||||
=== RUN TestShortSessionTTLAndLogout
|
||||
grade4_lab2_test.go:118: GET /api/v1/users/me: HTTP 200
|
||||
grade4_lab2_test.go:134: SESSION_TTL_SECONDS=2: expiry observed after 2.06287094s
|
||||
grade4_lab2_test.go:135: GET /api/v1/users/me: HTTP 401
|
||||
grade4_lab2_test.go:146: GET /api/v1/users/me: HTTP 401
|
||||
--- PASS: TestShortSessionTTLAndLogout (2.75s)
|
||||
=== RUN TestWrongPasswordAndLogoutHTTP
|
||||
--- PASS: TestWrongPasswordAndLogoutHTTP (1.20s)
|
||||
=== RUN TestDependencyFailuresReturnUnavailable
|
||||
redis: 2026/10/10 15:21:21 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/10/10 15:21:21 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/10/10 15:21:22 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
--- PASS: TestDependencyFailuresReturnUnavailable (2.32s)
|
||||
=== RUN TestHistoryQueryPlanAtTenThousandMessages
|
||||
=== RUN TestHistoryQueryPlanAtTenThousandMessages/first
|
||||
grade4_lab2_test.go:281: first page EXPLAIN (ANALYZE, BUFFERS): [
|
||||
{
|
||||
"Plan": {
|
||||
"Node Type": "Limit",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 4.29,
|
||||
"Plan Rows": 51,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.024,
|
||||
"Actual Total Time": 0.036,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Shared Hit Blocks": 3,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0,
|
||||
"Plans": [
|
||||
{
|
||||
"Node Type": "Index Scan",
|
||||
"Parent Relationship": "Outer",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Scan Direction": "Forward",
|
||||
"Index Name": "messages_history_idx",
|
||||
"Relation Name": "messages",
|
||||
"Alias": "messages",
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 784.70,
|
||||
"Plan Rows": 9999,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.023,
|
||||
"Actual Total Time": 0.030,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Index Cond": "((chat_id = '4ac64013-bb9b-43d6-a152-8af364484845'::uuid) AND (ROW(created_at, id) > ROW('0001-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
|
||||
"Rows Removed by Index Recheck": 0,
|
||||
"Shared Hit Blocks": 3,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"Planning": {
|
||||
"Shared Hit Blocks": 6,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
},
|
||||
"Planning Time": 0.245,
|
||||
"Triggers": [
|
||||
],
|
||||
"Execution Time": 0.390
|
||||
}
|
||||
]
|
||||
=== RUN TestHistoryQueryPlanAtTenThousandMessages/late
|
||||
grade4_lab2_test.go:281: late page EXPLAIN (ANALYZE, BUFFERS): [
|
||||
{
|
||||
"Plan": {
|
||||
"Node Type": "Limit",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 14.48,
|
||||
"Plan Rows": 51,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.034,
|
||||
"Actual Total Time": 0.052,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Shared Hit Blocks": 3,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0,
|
||||
"Plans": [
|
||||
{
|
||||
"Node Type": "Index Scan",
|
||||
"Parent Relationship": "Outer",
|
||||
"Parallel Aware": false,
|
||||
"Async Capable": false,
|
||||
"Scan Direction": "Forward",
|
||||
"Index Name": "messages_history_idx",
|
||||
"Relation Name": "messages",
|
||||
"Alias": "messages",
|
||||
"Startup Cost": 0.29,
|
||||
"Total Cost": 278.27,
|
||||
"Plan Rows": 999,
|
||||
"Plan Width": 69,
|
||||
"Actual Startup Time": 0.032,
|
||||
"Actual Total Time": 0.043,
|
||||
"Actual Rows": 51,
|
||||
"Actual Loops": 1,
|
||||
"Index Cond": "((chat_id = '4ac64013-bb9b-43d6-a152-8af364484845'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009001+00'::timestamp with time zone, '1156bfaa-b184-46bc-bcd4-3067c12301ad'::uuid)))",
|
||||
"Rows Removed by Index Recheck": 0,
|
||||
"Shared Hit Blocks": 3,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"Planning": {
|
||||
"Shared Hit Blocks": 0,
|
||||
"Shared Read Blocks": 0,
|
||||
"Shared Dirtied Blocks": 0,
|
||||
"Shared Written Blocks": 0,
|
||||
"Local Hit Blocks": 0,
|
||||
"Local Read Blocks": 0,
|
||||
"Local Dirtied Blocks": 0,
|
||||
"Local Written Blocks": 0,
|
||||
"Temp Read Blocks": 0,
|
||||
"Temp Written Blocks": 0
|
||||
},
|
||||
"Planning Time": 0.142,
|
||||
"Triggers": [
|
||||
],
|
||||
"Execution Time": 0.082
|
||||
}
|
||||
]
|
||||
--- PASS: TestHistoryQueryPlanAtTenThousandMessages (0.76s)
|
||||
--- PASS: TestHistoryQueryPlanAtTenThousandMessages/first (0.01s)
|
||||
--- PASS: TestHistoryQueryPlanAtTenThousandMessages/late (0.00s)
|
||||
=== RUN TestIdempotencyConcurrentStoresAndScopes
|
||||
--- PASS: TestIdempotencyConcurrentStoresAndScopes (1.08s)
|
||||
=== RUN TestIdempotencyRecordFailureRollsBackMessage
|
||||
--- PASS: TestIdempotencyRecordFailureRollsBackMessage (0.54s)
|
||||
=== RUN TestMessengerWorkflow
|
||||
--- PASS: TestMessengerWorkflow (1.06s)
|
||||
=== RUN TestCreateMessageBlankText
|
||||
--- PASS: TestCreateMessageBlankText (0.48s)
|
||||
=== RUN TestCreateMessageFromChatOutsider
|
||||
--- PASS: TestCreateMessageFromChatOutsider (0.84s)
|
||||
=== RUN TestListMessagesPagination
|
||||
--- PASS: TestListMessagesPagination (0.46s)
|
||||
=== RUN TestMessageLessUsesIDForEqualTimestamps
|
||||
--- PASS: TestMessageLessUsesIDForEqualTimestamps (0.00s)
|
||||
=== RUN TestListPageByChatUsesCursorAndLimit
|
||||
--- PASS: TestListPageByChatUsesCursorAndLimit (0.44s)
|
||||
=== RUN TestListPageByChatReturnsNonNilEmptyPage
|
||||
--- PASS: TestListPageByChatReturnsNonNilEmptyPage (0.12s)
|
||||
=== RUN TestPasswordKDFUsesSaltAndFullUTF8Password
|
||||
--- PASS: TestPasswordKDFUsesSaltAndFullUTF8Password (1.26s)
|
||||
=== RUN TestStoredPasswordUsesArgon2id
|
||||
--- PASS: TestStoredPasswordUsesArgon2id (0.48s)
|
||||
=== RUN TestBearerRequiredIgnoresXUserID
|
||||
--- PASS: TestBearerRequiredIgnoresXUserID (0.00s)
|
||||
=== RUN TestMessageCursorPreservesPosition
|
||||
--- PASS: TestMessageCursorPreservesPosition (0.00s)
|
||||
=== RUN TestCreateUserInvalidJSON
|
||||
--- PASS: TestCreateUserInvalidJSON (0.00s)
|
||||
=== RUN TestCreateUserDuplicateUsername
|
||||
--- PASS: TestCreateUserDuplicateUsername (0.81s)
|
||||
PASS
|
||||
ok messenger/src/backend/tests 23.863s
|
||||
python3 scripts/check_resources.py
|
||||
[
|
||||
{
|
||||
"service": "db",
|
||||
"instance": "edfcf3091ee4",
|
||||
"cpu_limit": 1.0,
|
||||
"memory_mib": 512,
|
||||
"networks": [
|
||||
"highload-lab3_data"
|
||||
],
|
||||
"public_ports": {}
|
||||
},
|
||||
{
|
||||
"service": "redis",
|
||||
"instance": "9878e4b8eced",
|
||||
"cpu_limit": 0.25,
|
||||
"memory_mib": 128,
|
||||
"networks": [
|
||||
"highload-lab3_data"
|
||||
],
|
||||
"public_ports": {}
|
||||
},
|
||||
{
|
||||
"service": "migrate",
|
||||
"instance": "d48adc3211d7",
|
||||
"cpu_limit": 0.5,
|
||||
"memory_mib": 128,
|
||||
"networks": [
|
||||
"highload-lab3_data"
|
||||
],
|
||||
"public_ports": {}
|
||||
},
|
||||
{
|
||||
"service": "api",
|
||||
"instance": "9d0505cca62a",
|
||||
"cpu_limit": 0.5,
|
||||
"memory_mib": 128,
|
||||
"networks": [
|
||||
"highload-lab3_data",
|
||||
"highload-lab3_proxy"
|
||||
],
|
||||
"public_ports": {}
|
||||
},
|
||||
{
|
||||
"service": "api",
|
||||
"instance": "d9e6ffbd1452",
|
||||
"cpu_limit": 0.5,
|
||||
"memory_mib": 128,
|
||||
"networks": [
|
||||
"highload-lab3_data",
|
||||
"highload-lab3_proxy"
|
||||
],
|
||||
"public_ports": {}
|
||||
},
|
||||
{
|
||||
"service": "haproxy",
|
||||
"instance": "1931592c46c7",
|
||||
"cpu_limit": 0.5,
|
||||
"memory_mib": 128,
|
||||
"networks": [
|
||||
"highload-lab3_edge",
|
||||
"highload-lab3_proxy"
|
||||
],
|
||||
"public_ports": {
|
||||
"8080/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8080"
|
||||
}
|
||||
],
|
||||
"8404/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8404"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "frontend",
|
||||
"instance": "ceb091ff4cee",
|
||||
"cpu_limit": 0.5,
|
||||
"memory_mib": 512,
|
||||
"networks": [
|
||||
"highload-lab3_edge"
|
||||
],
|
||||
"public_ports": {
|
||||
"5173/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "5173"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
PASS: effective CPU/RAM limits, two API replicas, private storage/API, isolated frontend
|
||||
python3 scripts/check_idempotency.py --base-url "http://localhost:8080"
|
||||
{"concurrent_requests": 24, "observed_instances": ["9d0505cca62a", "d9e6ffbd1452"], "messages_after_concurrent_repeat": 1}
|
||||
PASS: shared session, concurrent replay across replicas, key/body validation, independent scopes, reauthentication on replay
|
||||
python3 scripts/check_failover.py --base-url "http://localhost:8080"
|
||||
{"stopped_instance": "9d0505cca62a", "container_state": "exited", "successful_writes": 120, "successful_reads": 117, "write_errors": 0, "read_errors": 3, "first_write_seconds": 1.749, "first_read_seconds": 1.756, "elapsed_seconds": 15.026, "lb_exclusion_seconds": 1.739, "successful_rps": 15.773, "attempted_rps": 15.972, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
|
||||
Container highload-lab3-api-9 Running
|
||||
Container highload-lab3-api-10 Starting
|
||||
Container highload-lab3-api-10 Started
|
||||
Container highload-lab3-api-9 Waiting
|
||||
Container highload-lab3-api-10 Waiting
|
||||
Container highload-lab3-api-9 Healthy
|
||||
Container highload-lab3-api-10 Healthy
|
||||
{"stopped_instance": "d9e6ffbd1452", "container_state": "exited", "successful_writes": 117, "successful_reads": 117, "write_errors": 2, "read_errors": 2, "first_write_seconds": 1.84, "first_read_seconds": 1.728, "elapsed_seconds": 15.02, "lb_exclusion_seconds": 1.831, "successful_rps": 15.579, "attempted_rps": 15.845, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
|
||||
Container highload-lab3-api-10 Running
|
||||
Container highload-lab3-api-9 Starting
|
||||
Container highload-lab3-api-9 Started
|
||||
Container highload-lab3-api-9 Waiting
|
||||
Container highload-lab3-api-10 Waiting
|
||||
Container highload-lab3-api-9 Healthy
|
||||
Container highload-lab3-api-10 Healthy
|
||||
PASS: each API replica stopped in turn; reads, writes, sessions and confirmed messages preserved
|
||||
python3 scripts/check_rolling.py --base-url "http://localhost:8080"
|
||||
Container highload-lab3-migrate-run-532e0d9e43fd Creating
|
||||
Container highload-lab3-migrate-run-532e0d9e43fd Created
|
||||
2026/10/10 15:22:45 migration up complete
|
||||
Container highload-lab3-api-9 Running
|
||||
Container highload-lab3-api-10 Creating
|
||||
Container highload-lab3-api-10 Created
|
||||
Container highload-lab3-api-10 Starting
|
||||
Container highload-lab3-api-10 Started
|
||||
Container highload-lab3-api-10 Waiting
|
||||
Container highload-lab3-api-9 Waiting
|
||||
Container highload-lab3-api-10 Healthy
|
||||
Container highload-lab3-api-9 Healthy
|
||||
{"old_instance": "9d0505cca62a", "new_instance": "54723334925c", "survivor_instance": "d9e6ffbd1452", "replacement_seconds": 7.822, "graceful_shutdown": true}
|
||||
Container highload-lab3-api-10 Running
|
||||
Container highload-lab3-api-11 Creating
|
||||
Container highload-lab3-api-11 Created
|
||||
Container highload-lab3-api-11 Starting
|
||||
Container highload-lab3-api-11 Started
|
||||
Container highload-lab3-api-11 Waiting
|
||||
Container highload-lab3-api-10 Waiting
|
||||
Container highload-lab3-api-11 Healthy
|
||||
Container highload-lab3-api-10 Healthy
|
||||
{"old_instance": "d9e6ffbd1452", "new_instance": "818c316da5f1", "survivor_instance": "54723334925c", "replacement_seconds": 7.81, "graceful_shutdown": true}
|
||||
{
|
||||
"elapsed_seconds": 21.661,
|
||||
"concurrency": 4,
|
||||
"successful_writes": 1456,
|
||||
"successful_reads": 1548,
|
||||
"errors": 0,
|
||||
"successful_rps": 138.685,
|
||||
"replacements": [
|
||||
{
|
||||
"old_instance": "9d0505cca62a",
|
||||
"new_instance": "54723334925c",
|
||||
"survivor_instance": "d9e6ffbd1452",
|
||||
"replacement_seconds": 7.822,
|
||||
"graceful_shutdown": true
|
||||
},
|
||||
{
|
||||
"old_instance": "d9e6ffbd1452",
|
||||
"new_instance": "818c316da5f1",
|
||||
"survivor_instance": "54723334925c",
|
||||
"replacement_seconds": 7.81,
|
||||
"graceful_shutdown": true
|
||||
}
|
||||
],
|
||||
"confirmed_messages_preserved": true,
|
||||
"session_preserved": true,
|
||||
"workload": "two writers, two readers, 20ms pause per worker; not a capacity benchmark"
|
||||
}
|
||||
PASS: sequential replacement under load; all confirmed messages and sessions preserved
|
||||
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.
|
||||
Reference in New Issue
Block a user