66 lines
6.7 KiB
Plaintext
66 lines
6.7 KiB
Plaintext
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2> docker compose up -d --build --wait api
|
|
[+] Building 41.7s (15/15) FINISHED
|
|
=> [internal] load local bake definitions 0.0s
|
|
=> => reading from stdin 600B 0.0s
|
|
=> [internal] load build definition from Dockerfile 0.0s
|
|
=> => transferring dockerfile: 624B 0.0s
|
|
=> [internal] load metadata for docker.io/library/golang:1.26.3 1.3s
|
|
=> [internal] load .dockerignore 0.0s
|
|
=> => transferring context: 216B 0.0s
|
|
=> [build 1/7] FROM docker.io/library/golang:1.26.3@sha256:2d6c80227255c3112a4d08e67ba98e58efd3846daf15d9d7d4c389565d881b1a 0.0s
|
|
=> => resolve docker.io/library/golang:1.26.3@sha256:2d6c80227255c3112a4d08e67ba98e58efd3846daf15d9d7d4c389565d881b1a 0.0s
|
|
=> [internal] load build context 0.0s
|
|
=> => transferring context: 21.58kB 0.0s
|
|
=> CACHED [build 2/7] WORKDIR /src 0.0s
|
|
=> CACHED [build 3/7] COPY go.mod go.sum ./ 0.0s
|
|
=> CACHED [build 4/7] RUN go mod download 0.0s
|
|
=> [build 5/7] COPY cmd ./cmd 0.1s
|
|
=> [build 6/7] COPY internal ./internal 0.1s
|
|
=> [build 7/7] RUN go vet ./... && go test ./... && go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server 37.8s
|
|
=> [stage-1 1/1] COPY --from=build /out/server /server 0.1s
|
|
=> exporting to image 1.1s
|
|
=> => exporting layers 0.8s
|
|
=> => exporting manifest sha256:1e81433b5c10873e67cf1e4a124294d94272b03c8eadede16eb7bceec5719199 0.0s
|
|
=> => exporting config sha256:f14877115eb3a4ceb5e112742f113c35a4945a7c052ef0fd655f5f3169977a50 0.0s
|
|
=> => exporting attestation manifest sha256:cd37f504d9dfcec071258d7052d9d452192bce1a21e094df7f23b11ec630f536 0.0s
|
|
=> => exporting manifest list sha256:453e95559cf6bff46301c7d4b7c049c6f7f9e1a215715b248188b61fac3f8f44 0.0s
|
|
=> => naming to docker.io/library/messenger-lab2-api:latest 0.0s
|
|
=> => unpacking to docker.io/library/messenger-lab2-api:latest 0.1s
|
|
=> resolving provenance for metadata file 0.0s
|
|
[+] Running 3/3
|
|
✔ messenger-lab2-api Built 0.0s
|
|
✔ Container messenger-lab2-postgres-1 Healthy 2.4s
|
|
✔ Container messenger-lab2-api-1 Healthy 7.3s
|
|
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2> py student-tests/sessions.py
|
|
PASS: wrong/missing credentials 401; login JSON body 400
|
|
PASS: Bearer identifies user; X-User-Id and Basic give no access
|
|
PASS: logout 204; revoked token 401; other session remains valid
|
|
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2> $previousSessionTTL = $env:SESSION_TTL_SECONDS
|
|
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2>
|
|
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2> try {
|
|
>> $env:SESSION_TTL_SECONDS = '2'
|
|
>> docker compose up -d --wait api
|
|
>> if ($LASTEXITCODE -ne 0) { throw 'API did not start' }
|
|
>>
|
|
>> py student-tests/sessions.py --expiry
|
|
>> if ($LASTEXITCODE -ne 0) { throw 'Expiry test failed' }
|
|
>> }
|
|
>> finally {
|
|
>> if ($null -eq $previousSessionTTL) {
|
|
>> Remove-Item Env:SESSION_TTL_SECONDS -ErrorAction SilentlyContinue
|
|
>> } else {
|
|
>> $env:SESSION_TTL_SECONDS = $previousSessionTTL
|
|
>> }
|
|
>>
|
|
>> docker compose up -d --wait api
|
|
>> }
|
|
[+] Running 2/2
|
|
✔ Container messenger-lab2-postgres-1 Healthy 2.7s
|
|
✔ Container messenger-lab2-api-1 Healthy 7.7s
|
|
PASS: wrong/missing credentials 401; login JSON body 400
|
|
PASS: short TTL session works before expiry and returns 401 after expiry
|
|
[+] Running 2/2
|
|
✔ Container messenger-lab2-postgres-1 Healthy 2.5s
|
|
✔ Container messenger-lab2-api-1 Healthy 7.5s
|
|
PS C:\Users\homur\Documents\4 курс\ВП\ЛР\lab2\mtusi2026lab2>
|