feat(service): timeout_sec без дефолта; 0=нет таймаута; operator v0.1.48
- 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
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 2026-03-21 — chaos-slowquery: намеренно медленный запрос через pg_sleep.
|
||||
# Тестирует: timeout enforcement — платформа должна прервать запрос если > timeout_sec.
|
||||
# sleep_sec cap = 8 (меньше timeout_sec=10 сервиса → успех; >10 → таймаут платформы).
|
||||
import os, psycopg2
|
||||
|
||||
def slowquery(event):
|
||||
sleep_sec = min(float(event.get("sleep_sec", 2.0)), 8.0)
|
||||
conn = psycopg2.connect(
|
||||
host=os.environ["PGHOST"], port=int(os.environ.get("PGPORT", 5432)),
|
||||
dbname=os.environ["PGDATABASE"], user=os.environ["PGUSER"],
|
||||
password=os.environ["PGPASSWORD"], sslmode=os.environ.get("PGSSLMODE", "require"),
|
||||
)
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("SELECT pg_sleep(%s), now()::text", (sleep_sec,))
|
||||
result = cur.fetchone()
|
||||
return {"slept_sec": sleep_sec, "pg_now": result[1]}
|
||||
finally:
|
||||
conn.close()
|
||||
@@ -0,0 +1 @@
|
||||
psycopg2-binary
|
||||
Reference in New Issue
Block a user