ЛР 4: вложения в S3 и двусторонняя сверка хранилищ
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Проверки lab4 на отдельном Compose-стенде
|
||||
|
||||
В HTTP-проверках адрес стенда был `http://127.0.0.1:18094`. PostgreSQL и Redis для интеграционных тестов доступны только на loopback. Запускать сценарии отказов на синтетических данных в отдельном проекте.
|
||||
|
||||
Артефакты базовой реализации уровня 4, повторные проверки текущей реализации и команды запуска указаны в [отчёте](../../REPORT.md). [Манифест снимка](source.json) фиксирует исходники прогона. Полная проверка PostgreSQL, Redis и перезапусков повторена на [финальном снимке](../lab4-grade5/go.txt).
|
||||
|
||||
## Профиль памяти
|
||||
|
||||
Лёгкий сценарий использует публичный PNG 320 × 200. Для тяжёлого сценария можно воспроизвести PNG и JPEG размером 6000 × 6000 командой `generate` из [генератора](upload-fixture-generator.go.txt), сохранив его с расширением `.go` во временной папке и запустив `go run probe.go generate` из этой папки. Генерация выполняется отдельно от замера.
|
||||
|
||||
```sh
|
||||
python3 student-tests/lab4/upload_memory.py \
|
||||
--base-url http://127.0.0.1:18094 --project lab4-final-offline \
|
||||
--fixtures /path/to/generated --output /path/to/results
|
||||
```
|
||||
|
||||
Двенадцать клиентов выходят из одного барьера. Два профиля запускаются последовательно. `memory.peak` считан до и после каждого профиля, поэтому он относится к жизни контейнера. В обоих профилях счётчик вырос. Сырые выборки `memory.current` приложены в JSON. Сборщик не записывает пароли, токены и тела запросов.
|
||||
|
||||
## Отказы и границы
|
||||
|
||||
- `attachment_pixel_limit.py --base-url URL --output DIR` создаёт валидный PNG 6500 × 6200 и ожидает `413`.
|
||||
- `attachment_runtime_faults.py --base-url URL --output DIR --probe PATH --probe-image IMAGE` останавливает загрузившую реплику, проверяет SHA-256 с другой, восстанавливает API и затем отключает RustFS. Для прямого HTTP-запроса собери [probe](direct-probe.go.txt) под Linux и архитектуру Docker-хоста. `COMPOSE_PROJECT_NAME` должен начинаться с `lab4-final-`, а `COMPOSE_FILE` при необходимости включает override.
|
||||
- `attachment_compensation.py --spec SPEC --output DIR --as-hook` принимает JSON с `project`, `runtime` (каталог локальных secrets), `snapshot` (корень копии) и `base` (массив аргументов, начиная с `["docker","compose","-p",project]`). Используется выделенный Compose-проект. Тест включает SIGKILL API и короткий grace. [Результат](../lab4-grade5/compensation.json) · [Наблюдения](../lab4-grade5/compensation-events.jsonl)
|
||||
- `s3_infrastructure.py --project PROJECT --base-url URL --output DIR` проверяет bootstrap, настройки прав, анонимный доступ и консоль.
|
||||
|
||||
В [первой попытке](faults-first-attempt.txt) утилита nc закрыла соединение до получения HTTP-ответа. Повтор из сетевого пространства API дал `live=200`, `ready=503`, upload `503`. [Результат](s3-failure.json)
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"attachment_acl_bytes_and_idempotency": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.928,
|
||||
"requirement": "lab4_grade3",
|
||||
"status": "PASS"
|
||||
},
|
||||
"attachment_bucket_security": {
|
||||
"detail": "configure hooks.attachment_bucket_security before starting the fault",
|
||||
"elapsed_seconds": 0.0,
|
||||
"requirement": "lab4_grade4",
|
||||
"status": "PENDING_INFRA"
|
||||
},
|
||||
"attachment_compensation": {
|
||||
"detail": "configure hooks.attachment_compensation before starting the fault",
|
||||
"elapsed_seconds": 0.0,
|
||||
"requirement": "lab4_grade4",
|
||||
"status": "PENDING_INFRA"
|
||||
},
|
||||
"attachment_negative_uploads": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.776,
|
||||
"requirement": "lab4_grade4",
|
||||
"status": "PASS"
|
||||
},
|
||||
"attachment_parallel_memory": {
|
||||
"detail": "configure hooks.attachment_parallel_memory before starting the fault",
|
||||
"elapsed_seconds": 0.0,
|
||||
"requirement": "lab4_grade4",
|
||||
"status": "PENDING_INFRA"
|
||||
},
|
||||
"attachment_pixels_limit": {
|
||||
"detail": "configure hooks.attachment_pixels_limit before starting the fault",
|
||||
"elapsed_seconds": 0.0,
|
||||
"requirement": "lab4_grade3",
|
||||
"status": "PENDING_INFRA"
|
||||
},
|
||||
"attachment_s3_failure": {
|
||||
"detail": "configure hooks.attachment_s3_failure before starting the fault",
|
||||
"elapsed_seconds": 0.0,
|
||||
"requirement": "lab4_grade3",
|
||||
"status": "PENDING_INFRA"
|
||||
},
|
||||
"public_lb_endpoint": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.278,
|
||||
"requirement": "inherited_contract_or_requested_check",
|
||||
"status": "PASS"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
import ("bufio";"bytes";"encoding/json";"io";"net/http";"os";"strings";"time")
|
||||
func main(){
|
||||
in:=bufio.NewReader(os.Stdin)
|
||||
line,err:=in.ReadString('\n'); if err!=nil {panic(err)}
|
||||
token,err:=in.ReadString('\n'); if err!=nil {panic(err)}
|
||||
body,err:=io.ReadAll(in); if err!=nil {panic(err)}
|
||||
fields:=strings.Fields(line)
|
||||
req,err:=http.NewRequest(fields[0],"http://127.0.0.1:8080"+fields[1],bytes.NewReader(body)); if err!=nil {panic(err)}
|
||||
if t:=strings.TrimSpace(token); t!="" {req.Header.Set("Authorization","Bearer "+t); req.Header.Set("Content-Type","image/png")}
|
||||
res,err:=(&http.Client{Timeout:12*time.Second}).Do(req); if err!=nil {panic(err)}
|
||||
defer res.Body.Close()
|
||||
b,err:=io.ReadAll(res.Body); if err!=nil {panic(err)}
|
||||
if err:=json.NewEncoder(os.Stdout).Encode(map[string]any{"status":res.StatusCode,"body":string(b),"instance":res.Header.Get("X-Instance-Id")});err!=nil{panic(err)}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Traceback (most recent call last):
|
||||
File "test-output/faults.py", line 77, in <module>
|
||||
check((live,rd,upload)==(200,503,503) and b'unavailable' in body, "wrong API outage statuses")
|
||||
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "snapshot/tests/client.py", line 24, in check
|
||||
raise Failure(message)
|
||||
client.Failure: wrong API outage statuses
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"source": "1c2fc2215977",
|
||||
"replica": "38de6c779806",
|
||||
"failures": 0,
|
||||
"seconds": 0.023,
|
||||
"sha256": "99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75"
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
{
|
||||
"clients": 12,
|
||||
"files": [
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
},
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
},
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
},
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
},
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
},
|
||||
{
|
||||
"name": "load.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 642711
|
||||
},
|
||||
{
|
||||
"name": "load.jpg",
|
||||
"mime": "image/jpeg",
|
||||
"bytes": 1269896
|
||||
}
|
||||
],
|
||||
"statuses": {
|
||||
"201": 4,
|
||||
"429": 8
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 1.4950219999955152
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 1.4105649160046596
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.9557449580024695
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"status": 429,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 1.0306972920006956
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.9493740839970997
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"status": 429,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 1.0500210840036743
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"status": 429,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 1.0534772089959006
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"status": 429,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 1.0391598749993136
|
||||
},
|
||||
{
|
||||
"index": 8,
|
||||
"status": 429,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 1.0649052080043475
|
||||
},
|
||||
{
|
||||
"index": 9,
|
||||
"status": 429,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 1.0194469999987632
|
||||
},
|
||||
{
|
||||
"index": 10,
|
||||
"status": 429,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 1.0226270000057411
|
||||
},
|
||||
{
|
||||
"index": 11,
|
||||
"status": 429,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 1.034560625004815
|
||||
}
|
||||
],
|
||||
"replicas": {
|
||||
"38de6c779806": {
|
||||
"before_peak": 150097920,
|
||||
"after_peak": 294215680,
|
||||
"limit": 536870912,
|
||||
"samples": [
|
||||
[
|
||||
0.075,
|
||||
149831680
|
||||
],
|
||||
[
|
||||
0.134,
|
||||
148865024
|
||||
],
|
||||
[
|
||||
0.184,
|
||||
148680704
|
||||
],
|
||||
[
|
||||
0.24,
|
||||
148602880
|
||||
],
|
||||
[
|
||||
0.293,
|
||||
148631552
|
||||
],
|
||||
[
|
||||
0.347,
|
||||
148795392
|
||||
],
|
||||
[
|
||||
0.401,
|
||||
148758528
|
||||
],
|
||||
[
|
||||
0.455,
|
||||
149409792
|
||||
],
|
||||
[
|
||||
0.505,
|
||||
154324992
|
||||
],
|
||||
[
|
||||
0.559,
|
||||
162516992
|
||||
],
|
||||
[
|
||||
0.606,
|
||||
177471488
|
||||
],
|
||||
[
|
||||
0.659,
|
||||
188268544
|
||||
],
|
||||
[
|
||||
0.714,
|
||||
194568192
|
||||
],
|
||||
[
|
||||
0.764,
|
||||
202862592
|
||||
],
|
||||
[
|
||||
0.816,
|
||||
213696512
|
||||
],
|
||||
[
|
||||
0.869,
|
||||
219779072
|
||||
],
|
||||
[
|
||||
0.921,
|
||||
228106240
|
||||
],
|
||||
[
|
||||
0.974,
|
||||
238596096
|
||||
],
|
||||
[
|
||||
1.026,
|
||||
255332352
|
||||
],
|
||||
[
|
||||
1.077,
|
||||
268062720
|
||||
],
|
||||
[
|
||||
1.128,
|
||||
274460672
|
||||
],
|
||||
[
|
||||
1.179,
|
||||
282320896
|
||||
],
|
||||
[
|
||||
1.231,
|
||||
292990976
|
||||
],
|
||||
[
|
||||
1.285,
|
||||
292786176
|
||||
],
|
||||
[
|
||||
1.337,
|
||||
292786176
|
||||
],
|
||||
[
|
||||
1.388,
|
||||
293543936
|
||||
],
|
||||
[
|
||||
1.442,
|
||||
293543936
|
||||
],
|
||||
[
|
||||
1.492,
|
||||
293556224
|
||||
],
|
||||
[
|
||||
1.56,
|
||||
293953536
|
||||
],
|
||||
[
|
||||
1.606,
|
||||
293445632
|
||||
],
|
||||
[
|
||||
1.67,
|
||||
293560320
|
||||
],
|
||||
[
|
||||
1.716,
|
||||
293740544
|
||||
],
|
||||
[
|
||||
1.767,
|
||||
293765120
|
||||
],
|
||||
[
|
||||
1.818,
|
||||
292229120
|
||||
],
|
||||
[
|
||||
1.871,
|
||||
292200448
|
||||
],
|
||||
[
|
||||
1.923,
|
||||
292634624
|
||||
],
|
||||
[
|
||||
1.976,
|
||||
292233216
|
||||
],
|
||||
[
|
||||
2.037,
|
||||
291532800
|
||||
],
|
||||
[
|
||||
2.094,
|
||||
291721216
|
||||
],
|
||||
[
|
||||
2.14,
|
||||
291598336
|
||||
],
|
||||
[
|
||||
2.191,
|
||||
291680256
|
||||
]
|
||||
],
|
||||
"events_delta": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"restart_delta": 0,
|
||||
"same_start": true,
|
||||
"oom_killed": false
|
||||
},
|
||||
"1c2fc2215977": {
|
||||
"before_peak": 147574784,
|
||||
"after_peak": 430215168,
|
||||
"limit": 536870912,
|
||||
"samples": [
|
||||
[
|
||||
0.066,
|
||||
146915328
|
||||
],
|
||||
[
|
||||
0.117,
|
||||
146403328
|
||||
],
|
||||
[
|
||||
0.171,
|
||||
146513920
|
||||
],
|
||||
[
|
||||
0.223,
|
||||
146685952
|
||||
],
|
||||
[
|
||||
0.274,
|
||||
146599936
|
||||
],
|
||||
[
|
||||
0.328,
|
||||
146632704
|
||||
],
|
||||
[
|
||||
0.386,
|
||||
146812928
|
||||
],
|
||||
[
|
||||
0.437,
|
||||
147116032
|
||||
],
|
||||
[
|
||||
0.493,
|
||||
161148928
|
||||
],
|
||||
[
|
||||
0.543,
|
||||
169295872
|
||||
],
|
||||
[
|
||||
0.595,
|
||||
183906304
|
||||
],
|
||||
[
|
||||
0.649,
|
||||
190574592
|
||||
],
|
||||
[
|
||||
0.702,
|
||||
196771840
|
||||
],
|
||||
[
|
||||
0.758,
|
||||
205017088
|
||||
],
|
||||
[
|
||||
0.81,
|
||||
215502848
|
||||
],
|
||||
[
|
||||
0.861,
|
||||
223907840
|
||||
],
|
||||
[
|
||||
0.914,
|
||||
230154240
|
||||
],
|
||||
[
|
||||
0.966,
|
||||
238407680
|
||||
],
|
||||
[
|
||||
1.017,
|
||||
253476864
|
||||
],
|
||||
[
|
||||
1.07,
|
||||
270123008
|
||||
],
|
||||
[
|
||||
1.121,
|
||||
274477056
|
||||
],
|
||||
[
|
||||
1.173,
|
||||
282595328
|
||||
],
|
||||
[
|
||||
1.227,
|
||||
293322752
|
||||
],
|
||||
[
|
||||
1.283,
|
||||
293048320
|
||||
],
|
||||
[
|
||||
1.332,
|
||||
293031936
|
||||
],
|
||||
[
|
||||
1.387,
|
||||
295157760
|
||||
],
|
||||
[
|
||||
1.439,
|
||||
304148480
|
||||
],
|
||||
[
|
||||
1.49,
|
||||
325140480
|
||||
],
|
||||
[
|
||||
1.56,
|
||||
337682432
|
||||
],
|
||||
[
|
||||
1.644,
|
||||
356155392
|
||||
],
|
||||
[
|
||||
1.693,
|
||||
366571520
|
||||
],
|
||||
[
|
||||
1.744,
|
||||
385736704
|
||||
],
|
||||
[
|
||||
1.795,
|
||||
400392192
|
||||
],
|
||||
[
|
||||
1.846,
|
||||
415043584
|
||||
],
|
||||
[
|
||||
1.898,
|
||||
429740032
|
||||
],
|
||||
[
|
||||
1.951,
|
||||
428744704
|
||||
],
|
||||
[
|
||||
2.006,
|
||||
428699648
|
||||
],
|
||||
[
|
||||
2.06,
|
||||
428515328
|
||||
],
|
||||
[
|
||||
2.111,
|
||||
428564480
|
||||
],
|
||||
[
|
||||
2.162,
|
||||
428535808
|
||||
]
|
||||
],
|
||||
"events_delta": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"restart_delta": 0,
|
||||
"same_start": true,
|
||||
"oom_killed": false
|
||||
}
|
||||
},
|
||||
"sampling_seconds": 0.05
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
{
|
||||
"clients": 12,
|
||||
"files": [
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
},
|
||||
{
|
||||
"name": "sample.png",
|
||||
"mime": "image/png",
|
||||
"bytes": 111817
|
||||
}
|
||||
],
|
||||
"statuses": {
|
||||
"201": 12
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"index": 0,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.11950787499517901
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.1198934999993071
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.11025404199608602
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.1579494590041577
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.08275312499608845
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.0824889580035233
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.09312024999962887
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.15798666600312572
|
||||
},
|
||||
{
|
||||
"index": 8,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.16619729199737776
|
||||
},
|
||||
{
|
||||
"index": 9,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.09303424999961862
|
||||
},
|
||||
{
|
||||
"index": 10,
|
||||
"status": 201,
|
||||
"instance": "1c2fc2215977",
|
||||
"seconds": 0.134490292002738
|
||||
},
|
||||
{
|
||||
"index": 11,
|
||||
"status": 201,
|
||||
"instance": "38de6c779806",
|
||||
"seconds": 0.1474745419982355
|
||||
}
|
||||
],
|
||||
"replicas": {
|
||||
"38de6c779806": {
|
||||
"before_peak": 78581760,
|
||||
"after_peak": 82251776,
|
||||
"limit": 536870912,
|
||||
"samples": [
|
||||
[
|
||||
0.074,
|
||||
77082624
|
||||
],
|
||||
[
|
||||
0.126,
|
||||
76701696
|
||||
],
|
||||
[
|
||||
0.177,
|
||||
76554240
|
||||
],
|
||||
[
|
||||
0.228,
|
||||
76816384
|
||||
],
|
||||
[
|
||||
0.281,
|
||||
76812288
|
||||
],
|
||||
[
|
||||
0.338,
|
||||
77144064
|
||||
],
|
||||
[
|
||||
0.396,
|
||||
76996608
|
||||
],
|
||||
[
|
||||
0.45,
|
||||
77750272
|
||||
],
|
||||
[
|
||||
0.499,
|
||||
78159872
|
||||
],
|
||||
[
|
||||
0.552,
|
||||
78475264
|
||||
],
|
||||
[
|
||||
0.601,
|
||||
80609280
|
||||
],
|
||||
[
|
||||
0.652,
|
||||
80601088
|
||||
],
|
||||
[
|
||||
0.706,
|
||||
80605184
|
||||
],
|
||||
[
|
||||
0.759,
|
||||
80637952
|
||||
],
|
||||
[
|
||||
0.812,
|
||||
80785408
|
||||
],
|
||||
[
|
||||
0.864,
|
||||
80646144
|
||||
]
|
||||
],
|
||||
"events_delta": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"restart_delta": 0,
|
||||
"same_start": true,
|
||||
"oom_killed": false
|
||||
},
|
||||
"1c2fc2215977": {
|
||||
"before_peak": 78098432,
|
||||
"after_peak": 80687104,
|
||||
"limit": 536870912,
|
||||
"samples": [
|
||||
[
|
||||
0.074,
|
||||
76730368
|
||||
],
|
||||
[
|
||||
0.126,
|
||||
76226560
|
||||
],
|
||||
[
|
||||
0.178,
|
||||
76251136
|
||||
],
|
||||
[
|
||||
0.229,
|
||||
76247040
|
||||
],
|
||||
[
|
||||
0.281,
|
||||
76398592
|
||||
],
|
||||
[
|
||||
0.338,
|
||||
76300288
|
||||
],
|
||||
[
|
||||
0.396,
|
||||
76271616
|
||||
],
|
||||
[
|
||||
0.45,
|
||||
76718080
|
||||
],
|
||||
[
|
||||
0.499,
|
||||
77037568
|
||||
],
|
||||
[
|
||||
0.552,
|
||||
78348288
|
||||
],
|
||||
[
|
||||
0.602,
|
||||
78499840
|
||||
],
|
||||
[
|
||||
0.654,
|
||||
78487552
|
||||
],
|
||||
[
|
||||
0.707,
|
||||
78499840
|
||||
],
|
||||
[
|
||||
0.759,
|
||||
78700544
|
||||
],
|
||||
[
|
||||
0.812,
|
||||
78569472
|
||||
],
|
||||
[
|
||||
0.864,
|
||||
78299136
|
||||
]
|
||||
],
|
||||
"events_delta": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"restart_delta": 0,
|
||||
"same_start": true,
|
||||
"oom_killed": false
|
||||
}
|
||||
},
|
||||
"sampling_seconds": 0.05
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"width": 6500,
|
||||
"height": 6200,
|
||||
"encoded_bytes": 39249,
|
||||
"upload_status": 413
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
api 1c2fc22159776084669ac7ffdfc7ab18778485feb6810b4c534fb90baec30d62 2026-11-14T20:59:38.277558213Z
|
||||
api 38de6c779806333887d344e72f5de2b4a4336b6ef02cc8bfe400809ad3b711d3 2026-11-14T20:59:38.462321713Z
|
||||
attachment-cleanup e573c9b2f3fac6dbd03b8a941e8cff44199cbe5f8dcf0662d847ca60dfef3f33 2026-11-14T20:59:44.4007593Z
|
||||
lb 85e0635f043975812d11820b400edbf1e14428928e526e5a644e41fea9e210ce 2026-11-14T20:59:44.279379091Z
|
||||
migrate 8b1303443156719ba3c74bd9771f889a47689cdc447a254eb88ac44cb6ca6e3c 2026-11-14T20:58:31.100201127Z
|
||||
postgres aabd87a6deea77a10e45a268726a2aa5bdd3111d1b62e8a5238c4efe96fa9a9d 2026-11-14T20:59:31.482838877Z lab4-final-offline_postgres_data
|
||||
redis a6b9d8046bc219a2ee1f9624aab5a898f129f9081efcd241c8962941d65cb1b4 2026-11-14T20:59:31.973372085Z lab4-final-offline_redis_data
|
||||
s3 1dd57160fa6a64fa3ea2e95e097c623d2beaef1926fc8d5f75e2aedff601eaa0 2026-11-14T20:59:32.286071627Z lab4-final-offline_rustfs_data
|
||||
s3-init 7a365a86ababc0976e6b9cb4192bfa223a38e5baec615cc0a03bf369ec7a9042 2026-11-14T20:58:31.102788085Z
|
||||
@@ -0,0 +1,9 @@
|
||||
api 1c2fc22159776084669ac7ffdfc7ab18778485feb6810b4c534fb90baec30d62 2026-11-14T20:58:31.887295044Z
|
||||
api 38de6c779806333887d344e72f5de2b4a4336b6ef02cc8bfe400809ad3b711d3 2026-11-14T20:57:52.42195897Z
|
||||
attachment-cleanup e573c9b2f3fac6dbd03b8a941e8cff44199cbe5f8dcf0662d847ca60dfef3f33 2026-11-14T20:58:00.616614543Z
|
||||
lb 85e0635f043975812d11820b400edbf1e14428928e526e5a644e41fea9e210ce 2026-11-14T20:57:58.431995375Z
|
||||
migrate 8b1303443156719ba3c74bd9771f889a47689cdc447a254eb88ac44cb6ca6e3c 2026-11-14T20:58:31.100201127Z
|
||||
postgres aabd87a6deea77a10e45a268726a2aa5bdd3111d1b62e8a5238c4efe96fa9a9d 2026-11-14T20:57:46.098278675Z lab4-final-offline_postgres_data
|
||||
redis a6b9d8046bc219a2ee1f9624aab5a898f129f9081efcd241c8962941d65cb1b4 2026-11-14T20:57:45.953826092Z lab4-final-offline_redis_data
|
||||
s3 1dd57160fa6a64fa3ea2e95e097c623d2beaef1926fc8d5f75e2aedff601eaa0 2026-11-14T20:58:49.826562677Z lab4-final-offline_rustfs_data
|
||||
s3-init 7a365a86ababc0976e6b9cb4192bfa223a38e5baec615cc0a03bf369ec7a9042 2026-11-14T20:58:31.102788085Z
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"fault": "s3_unreachable",
|
||||
"live_status": 200,
|
||||
"ready_status": 503,
|
||||
"upload_status": 503,
|
||||
"false_ready_attachments": 0,
|
||||
"restored_original_checksum_equal": true
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"s3_api_bucket_scope_and_iam_denials": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 5.314,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_api_delete_effect": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.928,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_api_effective_policy": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.945,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_bootstrap_preserves_object_and_volume": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 2.742,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_console_closed_on_shared_network": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.749,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_fixture_cleanup": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 4.046,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_restart_preserves_original_bytes": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 6.263,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_setup_and_scenarios": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 26.37,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_two_replicas_after_restart": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.474,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_two_replicas_before": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.667,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
},
|
||||
"s3_unsigned_known_object_403": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 0.301,
|
||||
"requirement": "requested_operational_check",
|
||||
"status": "PASS"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{"bindings": [{"HostIp": "127.0.0.1", "HostPort": "18094"}], "event": "public_lb_endpoint", "port": 18094, "time_utc": "2026-11-14T20:58:41Z", "time_utc_ms": "2026-11-14T20:58:41.908+00:00"}
|
||||
{"api_ids": ["1c2fc22159776084669ac7ffdfc7ab18778485feb6810b4c534fb90baec30d62", "38de6c779806333887d344e72f5de2b4a4336b6ef02cc8bfe400809ad3b711d3"], "event": "s3_api_topology", "lb_id": "85e0635f043975812d11820b400edbf1e14428928e526e5a644e41fea9e210ce", "lb_image": "haproxy:3.2.24-alpine", "observed_instances": ["1c2fc2215977", "38de6c779806"], "same_token": true, "time_utc": "2026-11-14T20:58:42Z", "time_utc_ms": "2026-11-14T20:58:42.146+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.667, "event": "case", "name": "s3_two_replicas_before", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:58:42Z", "time_utc_ms": "2026-11-14T20:58:42.147+00:00"}
|
||||
{"control_bucket": "student-control-37a866cfecd04359ac1e1988712566b0", "create_probe_bucket": "student-forbidden-37a866cfecd04359ac1e1988712566b0", "event": "s3_initial", "fixture_prefix": "student-tests/s3-37a866cfecd04359ac1e1988712566b0/", "id": "1dd57160fa6a64fa3ea2e95e097c623d2beaef1926fc8d5f75e2aedff601eaa0", "image": "rustfs/rustfs:1.0.4", "payload_sha256": "15beb9311f947cccd73f69f39c44114ac8f7144c3b73b158610eba32f19fbcc8", "payload_size_bytes": 65824, "project": "lab4-final-offline", "running": true, "started_at": "2026-11-14T20:58:40.118706673Z", "time_utc": "2026-11-14T20:58:45Z", "time_utc_ms": "2026-11-14T20:58:45.585+00:00", "volumes": ["lab4-final-offline_rustfs_data"]}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "api_put_allowed_object", "s3_error_code": null, "time_utc": "2026-11-14T20:58:46Z", "time_utc_ms": "2026-11-14T20:58:46.220+00:00"}
|
||||
{"byte_equal": true, "event": "s3_roundtrip", "phase": "before_bootstrap", "sha256": "15beb9311f947cccd73f69f39c44114ac8f7144c3b73b158610eba32f19fbcc8", "size_bytes": 65824, "time_utc": "2026-11-14T20:58:46Z", "time_utc_ms": "2026-11-14T20:58:46.751+00:00"}
|
||||
{"attempt": 1, "event": "s3_bootstrap", "exit_code": 0, "time_utc": "2026-11-14T20:58:47Z", "time_utc_ms": "2026-11-14T20:58:47.491+00:00"}
|
||||
{"byte_equal": true, "event": "s3_roundtrip", "phase": "bootstrap_1", "sha256": "15beb9311f947cccd73f69f39c44114ac8f7144c3b73b158610eba32f19fbcc8", "size_bytes": 65824, "time_utc": "2026-11-14T20:58:48Z", "time_utc_ms": "2026-11-14T20:58:48.065+00:00"}
|
||||
{"attempt": 2, "event": "s3_bootstrap", "exit_code": 0, "time_utc": "2026-11-14T20:58:48Z", "time_utc_ms": "2026-11-14T20:58:48.830+00:00"}
|
||||
{"byte_equal": true, "event": "s3_roundtrip", "phase": "bootstrap_2", "sha256": "15beb9311f947cccd73f69f39c44114ac8f7144c3b73b158610eba32f19fbcc8", "size_bytes": 65824, "time_utc": "2026-11-14T20:58:49Z", "time_utc_ms": "2026-11-14T20:58:49.494+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 2.742, "event": "case", "name": "s3_bootstrap_preserves_object_and_volume", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:58:49Z", "time_utc_ms": "2026-11-14T20:58:49.494+00:00"}
|
||||
{"after": {"id": "1dd57160fa6a64fa3ea2e95e097c623d2beaef1926fc8d5f75e2aedff601eaa0", "image": "rustfs/rustfs:1.0.4", "running": true, "started_at": "2026-11-14T20:58:49.826562677Z", "volumes": ["lab4-final-offline_rustfs_data"]}, "before": {"id": "1dd57160fa6a64fa3ea2e95e097c623d2beaef1926fc8d5f75e2aedff601eaa0", "image": "rustfs/rustfs:1.0.4", "running": true, "started_at": "2026-11-14T20:58:40.118706673Z", "volumes": ["lab4-final-offline_rustfs_data"]}, "event": "s3_restart", "ready_seconds": 5.481, "time_utc": "2026-11-14T20:58:55Z", "time_utc_ms": "2026-11-14T20:58:55.101+00:00"}
|
||||
{"byte_equal": true, "event": "s3_roundtrip", "phase": "after_restart", "sha256": "15beb9311f947cccd73f69f39c44114ac8f7144c3b73b158610eba32f19fbcc8", "size_bytes": 65824, "time_utc": "2026-11-14T20:58:55Z", "time_utc_ms": "2026-11-14T20:58:55.755+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 6.263, "event": "case", "name": "s3_restart_preserves_original_bytes", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:58:55Z", "time_utc_ms": "2026-11-14T20:58:55.757+00:00"}
|
||||
{"bucket_list_status": 403, "event": "s3_unsigned", "object_get_status": 403, "time_utc": "2026-11-14T20:58:56Z", "time_utc_ms": "2026-11-14T20:58:56.059+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.301, "event": "case", "name": "s3_unsigned_known_object_403", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:58:56Z", "time_utc_ms": "2026-11-14T20:58:56.059+00:00"}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "api_list_allowed_bucket", "s3_error_code": null, "time_utc": "2026-11-14T20:58:56Z", "time_utc_ms": "2026-11-14T20:58:56.543+00:00"}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "prepare_control_bucket", "s3_error_code": null, "time_utc": "2026-11-14T20:58:57Z", "time_utc_ms": "2026-11-14T20:58:57.099+00:00"}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "prepare_control_object", "s3_error_code": null, "time_utc": "2026-11-14T20:58:57Z", "time_utc_ms": "2026-11-14T20:58:57.721+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 4, "operation": "api_other_bucket_put", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:58:58Z", "time_utc_ms": "2026-11-14T20:58:58.255+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 3, "operation": "api_other_bucket_get", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:58:58Z", "time_utc_ms": "2026-11-14T20:58:58.825+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 4, "operation": "api_other_bucket_delete", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:58:59Z", "time_utc_ms": "2026-11-14T20:58:59.375+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 3, "operation": "api_other_bucket_list", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:58:59Z", "time_utc_ms": "2026-11-14T20:58:59.847+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 4, "operation": "api_create_bucket", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:59:00Z", "time_utc_ms": "2026-11-14T20:59:00.330+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 1, "operation": "api_iam_user_list", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:59:00Z", "time_utc_ms": "2026-11-14T20:59:00.867+00:00"}
|
||||
{"authorization_denied": true, "event": "s3_operation", "exit_code": 1, "operation": "api_iam_policy_list", "s3_error_code": "AccessDenied", "time_utc": "2026-11-14T20:59:01Z", "time_utc_ms": "2026-11-14T20:59:01.373+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 5.314, "event": "case", "name": "s3_api_bucket_scope_and_iam_denials", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:01Z", "time_utc_ms": "2026-11-14T20:59:01.373+00:00"}
|
||||
{"event": "s3_effective_policy", "grants": [{"action": "s3:DeleteObject", "resource": "arn:aws:s3:::messenger-attachments/*"}, {"action": "s3:GetBucketLocation", "resource": "arn:aws:s3:::messenger-attachments"}, {"action": "s3:GetObject", "resource": "arn:aws:s3:::messenger-attachments/*"}, {"action": "s3:ListBucket", "resource": "arn:aws:s3:::messenger-attachments"}, {"action": "s3:PutObject", "resource": "arn:aws:s3:::messenger-attachments/*"}], "iam_admin_grants": 0, "inherited_groups": 0, "policy_name": "messenger-attachments-api-v1", "root_credentials_distinct": true, "time_utc": "2026-11-14T20:59:02Z", "time_utc_ms": "2026-11-14T20:59:02.317+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.945, "event": "case", "name": "s3_api_effective_policy", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:02Z", "time_utc_ms": "2026-11-14T20:59:02.318+00:00"}
|
||||
{"console_curl_exit": 7, "console_http_status": "000", "control_status": 200, "event": "s3_console", "time_utc": "2026-11-14T20:59:03Z", "time_utc_ms": "2026-11-14T20:59:03.066+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.749, "event": "case", "name": "s3_console_closed_on_shared_network", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:03Z", "time_utc_ms": "2026-11-14T20:59:03.067+00:00"}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "api_delete_allowed_object", "s3_error_code": null, "time_utc": "2026-11-14T20:59:03Z", "time_utc_ms": "2026-11-14T20:59:03.561+00:00"}
|
||||
{"authorization_denied": false, "event": "s3_operation", "exit_code": 0, "operation": "api_list_after_delete", "s3_error_code": null, "time_utc": "2026-11-14T20:59:03Z", "time_utc_ms": "2026-11-14T20:59:03.995+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.928, "event": "case", "name": "s3_api_delete_effect", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:03Z", "time_utc_ms": "2026-11-14T20:59:03.996+00:00"}
|
||||
{"bindings": [{"HostIp": "127.0.0.1", "HostPort": "18094"}], "event": "public_lb_endpoint", "port": 18094, "time_utc": "2026-11-14T20:59:04Z", "time_utc_ms": "2026-11-14T20:59:04.404+00:00"}
|
||||
{"api_ids": ["1c2fc22159776084669ac7ffdfc7ab18778485feb6810b4c534fb90baec30d62", "38de6c779806333887d344e72f5de2b4a4336b6ef02cc8bfe400809ad3b711d3"], "event": "s3_api_topology", "lb_id": "85e0635f043975812d11820b400edbf1e14428928e526e5a644e41fea9e210ce", "lb_image": "haproxy:3.2.24-alpine", "observed_instances": ["1c2fc2215977", "38de6c779806"], "same_token": true, "time_utc": "2026-11-14T20:59:04Z", "time_utc_ms": "2026-11-14T20:59:04.470+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 0.474, "event": "case", "name": "s3_two_replicas_after_restart", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:04Z", "time_utc_ms": "2026-11-14T20:59:04.471+00:00"}
|
||||
{"already_absent": false, "event": "s3_cleanup", "exit_code": 0, "operation": "object remove", "target": "root/messenger-attachments/student-tests/s3-37a866cfecd04359ac1e1988712566b0/roundtrip-37a866cfecd04359ac1e1988712566b0.bin", "time_utc": "2026-11-14T20:59:05Z", "time_utc_ms": "2026-11-14T20:59:05.546+00:00"}
|
||||
{"already_absent": false, "event": "s3_cleanup", "exit_code": 0, "operation": "object remove", "target": "root/student-control-37a866cfecd04359ac1e1988712566b0/sentinel.bin", "time_utc": "2026-11-14T20:59:06Z", "time_utc_ms": "2026-11-14T20:59:06.143+00:00"}
|
||||
{"already_absent": false, "event": "s3_cleanup", "exit_code": 0, "operation": "object remove", "target": "root/student-control-37a866cfecd04359ac1e1988712566b0/api-write.bin", "time_utc": "2026-11-14T20:59:06Z", "time_utc_ms": "2026-11-14T20:59:06.827+00:00"}
|
||||
{"already_absent": false, "event": "s3_cleanup", "exit_code": 0, "operation": "bucket remove", "target": "root/student-control-37a866cfecd04359ac1e1988712566b0", "time_utc": "2026-11-14T20:59:07Z", "time_utc_ms": "2026-11-14T20:59:07.803+00:00"}
|
||||
{"already_absent": true, "event": "s3_cleanup", "exit_code": 5, "operation": "bucket remove", "target": "root/student-forbidden-37a866cfecd04359ac1e1988712566b0", "time_utc": "2026-11-14T20:59:08Z", "time_utc_ms": "2026-11-14T20:59:08.516+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 4.046, "event": "case", "name": "s3_fixture_cleanup", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:08Z", "time_utc_ms": "2026-11-14T20:59:08.517+00:00"}
|
||||
{"detail": "", "elapsed_seconds": 26.37, "event": "case", "name": "s3_setup_and_scenarios", "requirement": "requested_operational_check", "status": "PASS", "time_utc": "2026-11-14T20:59:08Z", "time_utc_ms": "2026-11-14T20:59:08.517+00:00"}
|
||||
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"files": {
|
||||
"Dockerfile": "17e5c9fa261dbe5395791213f605787824957da6567586ce990e44e3fd5a1236",
|
||||
"Dockerfile.migrate": "0ab04cba4c2bb033c4d7c7d3a5984d8a27e8f355ff90e6023c3b7912d2211dec",
|
||||
"cmd/api/main.go": "e9568a3a1098b01fded10cdc502dac652bf6a3a5761914c6860c9f45b56ed269",
|
||||
"cmd/api/poolstats.go": "75c0ca950b85eaee3c0802e3001c61ba6436874b3be12cd38a5feb907b91528e",
|
||||
"cmd/attachment-cleanup/main.go": "347895c38d76e0c2d866dc4e1eb5b7555b447b796a77c5da8c2d6e7198f614d3",
|
||||
"cmd/migrate/main.go": "6e9d413a86f53cf5f2e83d5ed0308af9b2c33e69fcb3d061b19bf480e352f257",
|
||||
"cmd/migrate/main_test.go": "a88f2252d70caf644904331182dc3afd4df48b825a0329a82482798ec90b5d46",
|
||||
"cmd/migrate/postgres_test.go": "37401cd60657af560d52e727b08861f444ab18355d9decd9ceeeddb009d079ca",
|
||||
"cmd/migrate/roundtrip_test.go": "25b3425447b1dbafec83db2e5a7fc8172031908d5f5d57ce7b0d36a97850f8fa",
|
||||
"compose.yaml": "e67836432e988a1035a91ed028471e801fcf0827fb6ff4070f1e583abc06d787",
|
||||
"db/migrations/00001_init_schema.sql": "32223afbc24f8250de055690c9e86299ebf2cd7a0d3ef2c59d3b2a5aaa41e84e",
|
||||
"db/migrations/00002_add_created_at_defaults.sql": "e0680838294b93f916d727a3a20d83aca7c3f74077202c9696b1fc73cda14649",
|
||||
"db/migrations/00003_drop_session_table.sql": "1b666cee95b9eb1210b0a303de95994bd3c24628e9d9fdb1e1f3318edb756c3d",
|
||||
"db/migrations/00004_message_idempotency.sql": "e7b3dd5a056a702dfde7acba6666430477db0c7e03ae03fb270e145d6303b9b2",
|
||||
"db/migrations/00005_attachments.sql": "c28ca64fb84d6c60dc181e4cb0022461894274b85970df84bc38bb9984585bb4",
|
||||
"db/migrations/00006_allow_attachment_only_messages.sql": "ad56ecd0e8b88e0665cdc144aaa5d934ea7f48047cd702ce6f8832b6cf0bded3",
|
||||
"db/migrations/embed.go": "a42e52ab05bc89b557a5bc6b3f0215883d99c4a039a8b32d6c19e66b2f769508",
|
||||
"db/queries/attachments.sql": "15beeee95faf5b608179b0977a7dd45cd14a1c14df022e4c313194cb307646a0",
|
||||
"db/queries/chat_members.sql": "e70940e35f325550041c290a571901ead4a6f93dece857ffa229f2f1c83eddf8",
|
||||
"db/queries/chats.sql": "8c52c762da78eb3a3eb7402b17ec87bd7fc2e1387f6ddb8e297b4f2d75beca7b",
|
||||
"db/queries/message_idempotence.sql": "34259e4beee9cc07de4dec95c1d588222c7d756d02ac6564b54d6dbec36678db",
|
||||
"db/queries/messages.sql": "022c9f7aade55345f6cebd31f38084e73cb9a1419d56fa5316eaa36c9da52860",
|
||||
"db/queries/messages_attachments.sql": "753e5b46dbe94b1043fbe19c83850e697feef7ea9ccc348496b71cb6f9906ddb",
|
||||
"db/queries/users.sql": "0d73a6d46f4d4a1b0af37b750a208c07a38249f76974b41748f32c1949f990df",
|
||||
"go.mod": "0dbf79ae49966e763868e20b453addaecbb74085dd7b0579271f0839ca8a17cd",
|
||||
"go.sum": "30264a0cbc88f40ac455abb621624a54aa956bedd390c07deef4f67812efc982",
|
||||
"infra/README.md": "0e804fa51debba4c38d3cc84abf4704897665e0335b272060363f03aadd6354f",
|
||||
"infra/haproxy.cfg": "895a178e7354de61a5d40a2fe18b7b7c6d1d3d5faf0e5a5faa72783e7b983cb8",
|
||||
"infra/s3/bootstrap.sh": "baa4b0b6fa4bd2a76b194b672ef2ca8575858ef6abc7ddfbede3eec3534bc8ce",
|
||||
"internal/config/config.go": "142318dac05e3070358e7642c4b09813fe6bdb4d1b80e1154954d5e4e5f3fa59",
|
||||
"internal/database/postgres.go": "3925c0bc9ae01bff9a37138a0dd19b38074bc2a70536b3a148f568b952516a21",
|
||||
"internal/database/redis.go": "5b85a60bb0d1cb156c61bcd3c518c41c955f53c1d12da265b5e3a5dd7a397602",
|
||||
"internal/database/sqlc/attachments.sql.go": "15c2c687f98031d4f360ca9db10670f9dca3d7188d3a5b7df9d7705d55632871",
|
||||
"internal/database/sqlc/chat_members.sql.go": "9e8cd177f6f888c72d19857fd4748fbb2020770c1af772a463fe3d1b813b37ee",
|
||||
"internal/database/sqlc/chats.sql.go": "3dccf4b0ffa918ec5a3b66026b3dab4027456b499486359881000d184944802c",
|
||||
"internal/database/sqlc/db.go": "3ca71a7f007a39987cae838da64303419dd804d2d1b6227676f47177971d76cf",
|
||||
"internal/database/sqlc/message_idempotence.sql.go": "ebd31e6f369483eed8d6978dab1687552eed742a612b5ee4090499fe8a48a73f",
|
||||
"internal/database/sqlc/messages.sql.go": "224d6d8bd21426759ca6500e0eb3563564d51e639f1b6c64db4b3a43a5241c2a",
|
||||
"internal/database/sqlc/messages_attachments.sql.go": "821d863a01079edae53805769821f1dc5eb3e32620ce61efd7326bb0253d2204",
|
||||
"internal/database/sqlc/models.go": "df06356e705031dfc6226efd736f432853e026c26c30424675b99179819d422e",
|
||||
"internal/database/sqlc/users.sql.go": "b954abd5b5964df39c20d857a60105513af84c8df68ce1ac9421da541a7800f4",
|
||||
"internal/model/attachment.go": "877de511f5996c263c63c3e406ed67ee6609833f4946074594e1d438f8dce53a",
|
||||
"internal/model/chat.go": "e0213f8360ea106b3627aa50cc87710153ff8e353475b42c2becdb9a32592660",
|
||||
"internal/model/message.go": "4cebc4963e2eb104e85a1df6e8a93d6745c9ae42425df2d04bf6319e1d17b12d",
|
||||
"internal/model/session.go": "b455d730e4e3efc95c6d1fe74ab43d86153e4bf863c09efd36bfe57efc669bc2",
|
||||
"internal/model/user.go": "4bfd2d78e72f1c80b12541f2abc8500613e8f4d101575bd5d74fac22b52e3617",
|
||||
"internal/repository/attachment.go": "75069a930484f0c464a3d237c42aedaa5cc58b606068b8834bc78184426f7d46",
|
||||
"internal/repository/attachment_tx.go": "28fa001ae601fcc9b54e1e097b6e895d2f6ffb40b006c48a8862e0c822a2d896",
|
||||
"internal/repository/chat.go": "7ef8dca39ff371f16d351b073199c25f719db22c7a525ab76ea7aca948efa157",
|
||||
"internal/repository/errors.go": "9e3f77340ff87e41edc87380f795759701980685478737e7e4e1f9737e2634fa",
|
||||
"internal/repository/message.go": "2f92e2808317850ca5873cc26f8e6c4d83104e8fc957a89304fc74ba2f64cbf2",
|
||||
"internal/repository/postgres/attachment.go": "c37254509a9bf24158b73b8ae805c229a28b2aa2a203f7106d6c8a1ac69b10cd",
|
||||
"internal/repository/postgres/chat.go": "d757c579e5b6599ab9366aef46fd59f9652247f3d947615aa46c919746b65ea5",
|
||||
"internal/repository/postgres/errors.go": "580e5e599f7af8a403404c6850986e88efceda6393d21e772ac108be34004ba9",
|
||||
"internal/repository/postgres/message.go": "a2057f6fe6ba2a93a7f98bdbd799baf043999811e9fa7bb649e4f0d60138b6c2",
|
||||
"internal/repository/postgres/user.go": "eb6770e5cdd96b16a6e9d2116af89a6dd466dfbca4f4c179fe06c30c487e53c4",
|
||||
"internal/repository/postgres/utils.go": "6c5c83a8ad8ecf611812fbf8c90735e2590a09dec88cd914a10f6b36a9f041b7",
|
||||
"internal/repository/redis/errors.go": "ab56571d1d0b7d13b7d7ff868916f7e506c5a54c29e6bb211b3021ad4bf601ab",
|
||||
"internal/repository/redis/session.go": "c1654fea2ba47734a5403d6f6cbb2fe70fbe7e6e37166ae75f338d3490981de1",
|
||||
"internal/repository/session.go": "071285ff4d8033a6512a7256583a1cb32de782d6fd9f1696fac109927f7db699",
|
||||
"internal/repository/user.go": "bee65136137d97bea2240411c96a93cd945b1b9145452416f7a83733a1fd28e7",
|
||||
"internal/security/password.go": "8f74bef9216a2d12aa734e04fa786eac6b31f1378fe42f729fe1b97495c10487",
|
||||
"internal/service/attachment.go": "4b901d85d93d6dffde1bf76dd532b4b6845afd55ea7a8f9aaea983eaead1e9da",
|
||||
"internal/service/attachment_cleanup.go": "8e0112bacba6d90447c2be9884f34e5ca0be808af172e4cdaa4e6dea0f906dbb",
|
||||
"internal/service/auth.go": "71b8960640866e515e9060159af750c418d97a6373d2616c3b59b764172aa54c",
|
||||
"internal/service/chat.go": "bc7c8bea0066d8bbd926f78d2c100f0bd9a48c29fb542c5cfa3f2ae415299ef5",
|
||||
"internal/service/errors.go": "702b41496201ec42a69591eaa7c5154bf2aaf52aecbc1318a87d4a32ccc5d5df",
|
||||
"internal/service/helper.go": "390320fa296d9637630e6ac0d90c1229002b578a29186cad414896d5f4d1b8a6",
|
||||
"internal/service/message.go": "9556a18a5679d7e44b5cdcf329488185d2b90cadb3180af926df4bb6ab3f9d0d",
|
||||
"internal/service/user.go": "542051ef3eeff15d340979a615a7e0da3d21ed7ed93bea2547ab52d8e303b5e2",
|
||||
"internal/storage/errors.go": "9cc85df576c98b29c9cc9ed244bdae2aa3d03361c3bdb0307c2940202e99c377",
|
||||
"internal/storage/object_cleanup_storage.go": "ef50236baefe3e3aea8ca64264ae3c2e5fc89c245b9b1d7cfd207d354f0be2c9",
|
||||
"internal/storage/object_writer.go": "15ca1257b9c42f64a42f19a4bbb487e9d2950aed2fdf87959fe6c2d763998b64",
|
||||
"internal/storage/s3/client.go": "c6939f4dfd9ca8a7380010ff8551480cbff200b621af6f8b9ce444bd2a3f8a32",
|
||||
"internal/storage/s3/errors.go": "f5e058597d8d3cba2e5db7e81eb4c0a87f7d8b1c1d17a0aff2409801be0cd701",
|
||||
"internal/transport/http/handler/attachment.go": "885b2c4d24cbf0f5bfa9def4f6b5b4a7621919b47c3906d89a297abcf0c73da8",
|
||||
"internal/transport/http/handler/attachment_types.go": "90210075401601bacb25ae70dea2e19a203f537cf0f5aff1369679619bb87811",
|
||||
"internal/transport/http/handler/auth.go": "f175a570d47ca38ce627d0bc88b6f6a2adbf648345229fa961ea0144717744f1",
|
||||
"internal/transport/http/handler/auth_types.go": "5ffcd182606a77d538efb5f1a51df23b8a324a605b5d226026048d34c409ebdb",
|
||||
"internal/transport/http/handler/chat.go": "e5214ebf94ac9b8f37537e1a3fc844a2e8ae4e9b5aa159fe2b6e4da9ab2342f0",
|
||||
"internal/transport/http/handler/chat_types.go": "d181bce0f003749d813c1254df4c8ebcc1b99ff506b61efa6899da4a499e95f4",
|
||||
"internal/transport/http/handler/health.go": "1abf04652ea0b69bd87321b95e1a921d3c5ad3c04207232c2a9408bf722e550a",
|
||||
"internal/transport/http/handler/health_types.go": "02ee3031e10fbb279e020f409fbd905ae2640aa306b2c558c3f8e6dcfe9efa80",
|
||||
"internal/transport/http/handler/message.go": "540065ffc9090848fc25d560f1ad9734d4f0d45cdf0b5907a0f196f9efa8ede3",
|
||||
"internal/transport/http/handler/message_types.go": "270a9504a3001b1dc02a1f62cdaed12d69af2471340674e50022c609643dcb34",
|
||||
"internal/transport/http/handler/user.go": "86fd65ed176e9a83dc27c1112ff8384bc5aa32a92410290fb505d715ca167775",
|
||||
"internal/transport/http/handler/user_types.go": "0c4450be649afe5edf4e8d3ac9baada79deb9e1423ace56b87aa227ebd0eb998",
|
||||
"internal/transport/http/httputils/helper.go": "59c092950b69f5390427d0c6c1f90d2c33630d87a42bef363aed704960cb3a22",
|
||||
"internal/transport/http/middleware/auth.go": "413d7fb5f8573a808c2eb4e36becd29b4d7edffe5b096b26fc07ac22a0285430",
|
||||
"internal/transport/http/middleware/context.go": "f6db0e807659f30b05cae91f73c70d87f359760c57110e0d25b49a65bd0394a5",
|
||||
"internal/transport/http/middleware/logging.go": "a477fda512953eb9f46266537c12ace9cc992ba8f036a5b041f9f8295bfd2097",
|
||||
"internal/transport/http/router.go": "2841bac8988517591539336ba20718b4da7bae31ab81bf56e6b2b9bb59b0a297",
|
||||
"scripts/restart.sh": "5f70beb4337aed16881a0728229f02dce0e95d42028e0088acd52aa0a76eb019",
|
||||
"sqlc.yaml": "4e72de8f0b44d6d2b6a44da89f86dd5326e85077a5e7a8ae71816a5dff1fbaa3"
|
||||
},
|
||||
"source_tree_sha256": "f1dcdad773a3fb8de430ab9f85825dc61eba2954255dc5e0400c6c30ab9f84da",
|
||||
"submission_whitespace_only": {
|
||||
"db/migrations/00001_init_schema.sql": "48db014273f78be0f6eb97fc521cccc54f851dc99e3688d480d3a6ff7b9b6bbe",
|
||||
"db/migrations/00005_attachments.sql": "033d8884cecb50b5067453a97f2d7c51e51331a1911d9ddf8687437afa59443c",
|
||||
"db/queries/chat_members.sql": "c80b6e50c321ff94317545ea2f9fdee1dfd69f564d8638f7b111c8ec091ef03a",
|
||||
"db/queries/messages.sql": "f6f6382f27d698b1c2af2305d45699226ef10806b938b3dca78ec9087a622b7b",
|
||||
"internal/database/sqlc/messages.sql.go": "9836433d9645e6dd3bd66273ce15a53691f79093016c416fb24ffd085e62831e"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
type settings struct {
|
||||
Address, Instance, Token, Chat, CancelChat, EmptyCancelChat string
|
||||
}
|
||||
type status struct {
|
||||
HTTP int `json:"http_status"`
|
||||
Instance string `json:"instance"`
|
||||
Code string `json:"error_code,omitempty"`
|
||||
Retry string `json:"retry_after,omitempty"`
|
||||
SHA string `json:"sha256,omitempty"`
|
||||
Size int `json:"size_bytes,omitempty"`
|
||||
RequestID string `json:"request_id,omitempty"`
|
||||
Elapsed float64 `json:"elapsed_seconds"`
|
||||
}
|
||||
type event map[string]any
|
||||
|
||||
var events []event
|
||||
|
||||
func record(name string, data any) {
|
||||
events = append(events, event{"event": name, "time_utc": time.Now().UTC().Format(time.RFC3339Nano), "data": data})
|
||||
}
|
||||
func check(ok bool, description string) error {
|
||||
if !ok {
|
||||
return errors.New(description)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func decode(resp *http.Response, start time.Time) (status, error) {
|
||||
defer resp.Body.Close()
|
||||
var value struct {
|
||||
Error struct {
|
||||
Code string `json:"code"`
|
||||
} `json:"error"`
|
||||
SHA string `json:"sha256"`
|
||||
Size int `json:"size_bytes"`
|
||||
}
|
||||
err := json.NewDecoder(resp.Body).Decode(&value)
|
||||
return status{HTTP: resp.StatusCode, Instance: resp.Header.Get("X-Instance-Id"), Retry: resp.Header.Get("Retry-After"),
|
||||
Code: value.Error.Code, SHA: value.SHA, Size: value.Size, RequestID: resp.Header.Get("X-Request-Id"), Elapsed: time.Since(start).Seconds()}, err
|
||||
}
|
||||
func path(chat, filename string) string {
|
||||
return "/api/v1/chats/" + chat + "/attachments?filename=" + filename
|
||||
}
|
||||
func post(c settings, filename, mime string, body []byte) (status, error) {
|
||||
start := time.Now()
|
||||
req, err := http.NewRequest("POST", "http://"+c.Address+path(c.Chat, filename), bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return status{}, err
|
||||
}
|
||||
req.Header.Set("Content-Type", mime)
|
||||
req.Header.Set("Authorization", "Bearer "+c.Token)
|
||||
// One connection per upload makes the simultaneous requests independent.
|
||||
req.Close = true
|
||||
resp, err := (&http.Client{Timeout: 12 * time.Second}).Do(req)
|
||||
if err != nil {
|
||||
return status{Elapsed: time.Since(start).Seconds()}, err
|
||||
}
|
||||
return decode(resp, start)
|
||||
}
|
||||
|
||||
type pending struct {
|
||||
conn net.Conn
|
||||
reader *bufio.Reader
|
||||
start time.Time
|
||||
}
|
||||
|
||||
func begin(c settings, chat, filename string, length int, expect bool) (*pending, error) {
|
||||
conn, err := net.DialTimeout("tcp", c.Address, 2*time.Second)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conn.SetDeadline(time.Now().Add(8 * time.Second))
|
||||
expectation := ""
|
||||
if expect {
|
||||
expectation = "Expect: 100-continue\r\n"
|
||||
}
|
||||
_, err = fmt.Fprintf(conn, "POST %s HTTP/1.1\r\nHost: %s\r\nAuthorization: Bearer %s\r\nContent-Type: image/png\r\nContent-Length: %d\r\n%sConnection: close\r\n\r\n", path(chat, filename), c.Address, c.Token, length, expectation)
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
return nil, err
|
||||
}
|
||||
return &pending{conn, bufio.NewReader(conn), time.Now()}, nil
|
||||
}
|
||||
func (p *pending) provisional() error {
|
||||
response, err := http.ReadResponse(p.reader, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response.Body.Close()
|
||||
return check(response.StatusCode == 100, fmt.Sprintf("expected provisional 100, got %d", response.StatusCode))
|
||||
}
|
||||
func (p *pending) finish(body []byte) (status, error) {
|
||||
if _, err := p.conn.Write(body); err != nil {
|
||||
return status{}, err
|
||||
}
|
||||
response, err := http.ReadResponse(p.reader, nil)
|
||||
if err != nil {
|
||||
return status{}, err
|
||||
}
|
||||
return decode(response, p.start)
|
||||
}
|
||||
func valid(value status, expectedInstance string, payload []byte) error {
|
||||
return check(value.HTTP == 201 && (expectedInstance == "" || value.Instance == expectedInstance) &&
|
||||
value.SHA == fmt.Sprintf("%x", sha256.Sum256(payload)) && value.Size == len(payload) &&
|
||||
value.RequestID != "", fmt.Sprintf("expected valid 201 from %s, got %d from %s", expectedInstance, value.HTTP, value.Instance))
|
||||
}
|
||||
func controlled(c settings) error {
|
||||
body, err := os.ReadFile("/input/sample.png")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
first, err := begin(c, c.Chat, "held-a.png", len(body), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer first.conn.Close()
|
||||
if err := first.provisional(); err != nil {
|
||||
return err
|
||||
}
|
||||
second, err := begin(c, c.Chat, "held-b.png", len(body), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer second.conn.Close()
|
||||
if err := second.provisional(); err != nil {
|
||||
return err
|
||||
}
|
||||
record("both_slots_held", event{"provisional_statuses": []int{100, 100}, "body_bytes_sent": 0})
|
||||
limited, err := post(c, "limited.png", "image/png", body)
|
||||
record("third_upload", limited)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := check(limited.HTTP == 429 && limited.Code == "rate_limited" && limited.Retry == "1" &&
|
||||
limited.Instance == c.Instance && limited.RequestID != "" && limited.Elapsed >= .9 && limited.Elapsed <= 1.5,
|
||||
"third upload did not return the expected 429, Retry-After and one-second wait"); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, cancel := range []struct {
|
||||
chat string
|
||||
size int
|
||||
}{
|
||||
{c.CancelChat, len(body)}, {c.EmptyCancelChat, 0},
|
||||
} {
|
||||
waiter, err := begin(c, cancel.chat, "cancel.png", cancel.size, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(220 * time.Millisecond)
|
||||
waiter.conn.Close()
|
||||
record("waiter_disconnected", event{"chat_id": cancel.chat, "declared_bytes": cancel.size, "body_bytes_sent": 0,
|
||||
"disconnect_after_seconds": time.Since(waiter.start).Seconds()})
|
||||
}
|
||||
// Both slots stay occupied for longer than the wait timeout, so server logs
|
||||
// distinguish cancellation from a later slot grant.
|
||||
time.Sleep(1150 * time.Millisecond)
|
||||
r, err := first.finish(body)
|
||||
record("first_holder_finished", r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := valid(r, c.Instance, body); err != nil {
|
||||
return err
|
||||
}
|
||||
r, err = post(c, "after-release.png", "image/png", body)
|
||||
record("upload_after_release", r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := valid(r, c.Instance, body); err != nil {
|
||||
return err
|
||||
}
|
||||
r, err = second.finish(body)
|
||||
record("second_holder_finished", r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return valid(r, c.Instance, body)
|
||||
}
|
||||
func load(c settings) error {
|
||||
pngData, err := os.ReadFile("/input/load.png")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
jpegData, err := os.ReadFile("/input/load.jpg")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
payloads := []struct {
|
||||
name, mime string
|
||||
data []byte
|
||||
}{{"load.png", "image/png", pngData}, {"load.jpg", "image/jpeg", jpegData}}
|
||||
const count = 12
|
||||
var wg, ready sync.WaitGroup
|
||||
var active, peak atomic.Int32
|
||||
start := make(chan struct{})
|
||||
done := make(chan event, count)
|
||||
for i := 0; i < count; i++ {
|
||||
wg.Add(1)
|
||||
ready.Add(1)
|
||||
go func(i int) {
|
||||
defer wg.Done()
|
||||
p := payloads[i%len(payloads)]
|
||||
ready.Done()
|
||||
<-start
|
||||
n := active.Add(1)
|
||||
for current := peak.Load(); n > current && !peak.CompareAndSwap(current, n); current = peak.Load() {
|
||||
}
|
||||
value, err := post(c, p.name, p.mime, p.data)
|
||||
active.Add(-1)
|
||||
detail := event{"request": i + 1, "file": p.name, "response": value}
|
||||
if err == nil {
|
||||
if value.HTTP == 201 {
|
||||
err = valid(value, "", p.data)
|
||||
} else if value.HTTP == 429 {
|
||||
err = check(value.Code == "rate_limited" && value.Retry == "1" && value.Instance != "" && value.RequestID != "", "invalid rate limit response")
|
||||
} else {
|
||||
err = fmt.Errorf("unexpected status %d", value.HTTP)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
detail["failure"] = err.Error()
|
||||
}
|
||||
done <- detail
|
||||
}(i)
|
||||
}
|
||||
ready.Wait()
|
||||
close(start)
|
||||
wg.Wait()
|
||||
close(done)
|
||||
failures := 0
|
||||
for detail := range done {
|
||||
record("concurrent_response", detail)
|
||||
if detail["failure"] != nil {
|
||||
failures++
|
||||
}
|
||||
}
|
||||
record("concurrent_peak", event{"workers": count, "client_in_flight_peak": peak.Load()})
|
||||
return check(peak.Load() >= 10 && failures == 0, "load had fewer than 10 overlapping requests or contained unexpected responses")
|
||||
}
|
||||
func generate(directory string) error {
|
||||
const width, height = 6000, 6000
|
||||
img := image.NewNRGBA(image.Rect(0, 0, width, height))
|
||||
for y := 0; y < height; y++ {
|
||||
for x := 0; x < width; x++ {
|
||||
i := y*img.Stride + x*4
|
||||
img.Pix[i] = byte(x/12 + y/36)
|
||||
img.Pix[i+1] = byte(x/24 - y/9)
|
||||
img.Pix[i+2] = byte((x / 8) ^ (y / 16))
|
||||
img.Pix[i+3] = 255
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"load.png", "load.jpg"} {
|
||||
f, err := os.Create(filepath.Join(directory, name))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.HasSuffix(name, "png") {
|
||||
err = png.Encode(f, img)
|
||||
} else {
|
||||
err = jpeg.Encode(f, img, &jpeg.Options{Quality: 90})
|
||||
}
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func main() {
|
||||
if len(os.Args) != 2 {
|
||||
os.Exit(2)
|
||||
}
|
||||
if os.Args[1] == "generate" {
|
||||
if err := generate("."); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
var c settings
|
||||
if err := json.NewDecoder(os.Stdin).Decode(&c); err != nil {
|
||||
os.Exit(2)
|
||||
}
|
||||
var err error
|
||||
switch os.Args[1] {
|
||||
case "controlled":
|
||||
err = controlled(c)
|
||||
case "load":
|
||||
err = load(c)
|
||||
default:
|
||||
err = errors.New("unknown mode")
|
||||
}
|
||||
report := event{"events": events}
|
||||
if err != nil {
|
||||
report["failure"] = err.Error()
|
||||
}
|
||||
json.NewEncoder(os.Stdout).Encode(report)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user