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.1s

#3 [internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#3 DONE 0.1s

#4 [internal] load .dockerignore
#4 transferring context: 268B 0.0s done
#4 DONE 0.0s

#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 4/6] RUN go mod download
#7 CACHED

#8 [builder 5/6] COPY backend ./backend
#8 CACHED

#9 [builder 2/6] WORKDIR /src
#9 CACHED

#10 [builder 3/6] COPY go.mod go.sum ./
#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 done
#12 exporting manifest sha256:4bd45c73a0da989b49052aa8050de520bf58aec57ea4df0596741bae3c1224d7 done
#12 exporting config sha256:37436eaab83b2bd6086c7f26cc412f7df6ae3d992339866ca29907f65fd1e477 done
#12 exporting attestation manifest sha256:17297671d082e07cef2ee562c0b963492b727f6ecc2e64f266de8a57c776b545 0.0s done
#12 exporting manifest list sha256:ba973aacf88dff80976bad611e00fa3eb970c5ccb39e0657d08f1da32254b315 0.0s done
#12 naming to docker.io/library/highload-lab3-backend-tests:latest done
#12 unpacking to docker.io/library/highload-lab3-backend-tests:latest 0.0s done
#12 DONE 0.2s

#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-e074c1f99f21 Creating 
 Container highload-lab3-backend-tests-run-e074c1f99f21 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 (3.81s)
=== RUN   TestConcurrentRegistrationSameUsername
--- PASS: TestConcurrentRegistrationSameUsername (1.77s)
=== RUN   TestChatTransactionRollsBackAfterMemberInsertFailure
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (1.16s)
=== 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.040445852s
    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.58s)
=== RUN   TestWrongPasswordAndLogoutHTTP
--- PASS: TestWrongPasswordAndLogoutHTTP (1.29s)
=== RUN   TestDependencyFailuresReturnUnavailable
redis: 2026/10/10 16:22:37 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 16:22:37 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 16:22:38 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.27s)
=== 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.009,
              "Actual Total Time": 0.017,
              "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.009,
                  "Actual Total Time": 0.013,
                  "Actual Rows": 51,
                  "Actual Loops": 1,
                  "Index Cond": "((chat_id = '352885bc-3c03-480d-8e27-9a9385cb31b2'::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.056,
            "Triggers": [
            ],
            "Execution Time": 0.112
          }
        ]
=== 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.030,
              "Actual Total Time": 0.123,
              "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.029,
                  "Actual Total Time": 0.116,
                  "Actual Rows": 51,
                  "Actual Loops": 1,
                  "Index Cond": "((chat_id = '352885bc-3c03-480d-8e27-9a9385cb31b2'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009001+00'::timestamp with time zone, '47274720-3d97-4f7c-965e-6214ee2f6828'::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.154,
            "Triggers": [
            ],
            "Execution Time": 0.159
          }
        ]
--- PASS: TestHistoryQueryPlanAtTenThousandMessages (0.78s)
    --- PASS: TestHistoryQueryPlanAtTenThousandMessages/first (0.00s)
    --- PASS: TestHistoryQueryPlanAtTenThousandMessages/late (0.00s)
=== RUN   TestIdempotencyConcurrentStoresAndScopes
--- PASS: TestIdempotencyConcurrentStoresAndScopes (1.06s)
=== RUN   TestIdempotencyRecordFailureRollsBackMessage
--- PASS: TestIdempotencyRecordFailureRollsBackMessage (0.47s)
=== RUN   TestMessengerWorkflow
--- PASS: TestMessengerWorkflow (0.80s)
=== RUN   TestCreateMessageBlankText
--- PASS: TestCreateMessageBlankText (0.47s)
=== RUN   TestCreateMessageFromChatOutsider
--- PASS: TestCreateMessageFromChatOutsider (0.74s)
=== RUN   TestListMessagesPagination
--- PASS: TestListMessagesPagination (0.46s)
=== RUN   TestMessageLessUsesIDForEqualTimestamps
--- PASS: TestMessageLessUsesIDForEqualTimestamps (0.00s)
=== RUN   TestListPageByChatUsesCursorAndLimit
--- PASS: TestListPageByChatUsesCursorAndLimit (0.47s)
=== RUN   TestListPageByChatReturnsNonNilEmptyPage
--- PASS: TestListPageByChatReturnsNonNilEmptyPage (0.14s)
=== RUN   TestPasswordKDFUsesSaltAndFullUTF8Password
--- PASS: TestPasswordKDFUsesSaltAndFullUTF8Password (1.28s)
=== RUN   TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.43s)
=== RUN   TestBearerRequiredIgnoresXUserID
--- PASS: TestBearerRequiredIgnoresXUserID (0.00s)
=== RUN   TestMessageCursorPreservesPosition
--- PASS: TestMessageCursorPreservesPosition (0.00s)
=== RUN   TestCreateUserInvalidJSON
--- PASS: TestCreateUserInvalidJSON (0.00s)
=== RUN   TestCreateUserDuplicateUsername
--- PASS: TestCreateUserDuplicateUsername (0.79s)
PASS
ok  	messenger/src/backend/tests	21.998s
