- api/v1alpha1/service_types.go: убрать +kubebuilder:default=30
- invoke.go: TimeoutSec=0 → &http.Client{} (без таймаута)
- services.go: валидация timeout_sec < 0 || > 900 → HTTP 400
- service_resource.go: TF schema Optional (без Computed); 0 → Int64Null()
- deployments/k8s/operator.yaml: v0.1.47 → v0.1.48
- doc/: progress.md + api/design.md (модель Service) + decisions/log.md
- examples/POSTGRES/: bug_hunter.sh, chaos_marathon.sh, chaos_marathon.tf
28 lines
935 B
Python
28 lines
935 B
Python
# 2026-03-21 — chaos-bigpayload: генерирует/принимает большой JSON.
|
|
# Тестирует: большие ответы (64KB+), память рантайма.
|
|
import json, time
|
|
|
|
def bigpayload(event):
|
|
size_kb = min(int(event.get("size_kb", 16)), 256) # cap 256KB
|
|
word = str(event.get("word", "x"))[:32]
|
|
|
|
# Генерируем список строк нужного размера
|
|
chunk = word * 32 # ~32+ байт на запись
|
|
items = []
|
|
total = 0
|
|
target = size_kb * 1024
|
|
i = 0
|
|
while total < target:
|
|
entry = f"{chunk}-{i}"
|
|
items.append(entry)
|
|
total += len(entry) + 3 # 3 байта JSON overhead
|
|
i += 1
|
|
|
|
return {
|
|
"items_count": len(items),
|
|
"size_kb_approx": round(total / 1024, 1),
|
|
"first": items[0] if items else "",
|
|
"last": items[-1] if items else "",
|
|
"ts": int(time.time()),
|
|
}
|