4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
101 lines
3.1 KiB
Python
101 lines
3.1 KiB
Python
"""Paths and experiment manifest ordering (YAML/JSON live in this package directory)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
# Kubernetes manifests and experiments/ tree sit next to this module (see README.md).
|
|
CHAOS_ENGINEERING_DIR: Path = Path(__file__).resolve().parent
|
|
EXPERIMENTS_DIR: Path = CHAOS_ENGINEERING_DIR / "experiments"
|
|
|
|
CLUSTER_NAME_DEFAULT = "tracer-k8s-test"
|
|
KUBECTL_CONTEXT_DEFAULT = f"kind-{CLUSTER_NAME_DEFAULT}"
|
|
DATADOG_NAMESPACE_DEFAULT = "tracer-test"
|
|
CHAOS_MESH_NAMESPACE_DEFAULT = "chaos-mesh"
|
|
|
|
BASE_MANIFESTS_APPLY_ORDER: tuple[str, ...] = (
|
|
"chaos-demo.yaml",
|
|
"experiments/crashloop/crashloop-demo.yaml",
|
|
"pod-kill-demo.yaml",
|
|
)
|
|
|
|
BASE_MANIFESTS_DELETE_ORDER: tuple[str, ...] = (
|
|
"pod-kill-demo.yaml",
|
|
"experiments/crashloop/crashloop-demo.yaml",
|
|
"chaos-demo.yaml",
|
|
)
|
|
|
|
|
|
def chaos_engineering_path(*parts: str) -> Path:
|
|
return CHAOS_ENGINEERING_DIR.joinpath(*parts)
|
|
|
|
|
|
def list_experiment_names() -> list[str]:
|
|
"""Directory names under experiments/ that contain at least one YAML file."""
|
|
if not EXPERIMENTS_DIR.is_dir():
|
|
return []
|
|
names: list[str] = []
|
|
for p in sorted(EXPERIMENTS_DIR.iterdir()):
|
|
if p.is_dir() and any(p.glob("*.yaml")):
|
|
names.append(p.name)
|
|
return names
|
|
|
|
|
|
class ExperimentNotFoundError(FileNotFoundError):
|
|
"""No experiment directory or no YAML under experiments/<name>."""
|
|
|
|
|
|
def experiment_demo_yaml_paths(name: str) -> list[Path]:
|
|
exp = EXPERIMENTS_DIR / name
|
|
if not exp.is_dir():
|
|
raise ExperimentNotFoundError(f"No experiment directory: {name!r}")
|
|
return sorted(exp.glob("*-demo.yaml"))
|
|
|
|
|
|
def experiment_chaos_yaml_paths(name: str) -> list[Path]:
|
|
exp = EXPERIMENTS_DIR / name
|
|
if not exp.is_dir():
|
|
raise ExperimentNotFoundError(f"No experiment directory: {name!r}")
|
|
return sorted(exp.glob("*-chaos.yaml"))
|
|
|
|
|
|
def validate_experiment(name: str) -> None:
|
|
"""Raise ExperimentNotFoundError if directory or YAML is missing."""
|
|
demos = experiment_demo_yaml_paths(name)
|
|
chaos = experiment_chaos_yaml_paths(name)
|
|
if not demos or not chaos:
|
|
raise ExperimentNotFoundError(f"No *-demo.yaml or *-chaos.yaml in experiment: {name!r}")
|
|
|
|
|
|
def experiment_has_manifests(name: str) -> bool:
|
|
try:
|
|
validate_experiment(name)
|
|
except ExperimentNotFoundError:
|
|
return False
|
|
return True
|
|
|
|
|
|
def infer_chaos_kind(chaos_yaml: Path) -> str | None:
|
|
"""Best-effort parse of the first document's kind: field."""
|
|
try:
|
|
import yaml
|
|
|
|
text = chaos_yaml.read_text(encoding="utf-8")
|
|
for doc in yaml.safe_load_all(text):
|
|
if isinstance(doc, dict) and doc.get("kind"):
|
|
return str(doc["kind"])
|
|
except Exception:
|
|
return None
|
|
return None
|
|
|
|
|
|
def experiment_summary_line(name: str) -> str:
|
|
"""One-line description for list output."""
|
|
kinds: list[str] = []
|
|
for p in experiment_chaos_yaml_paths(name):
|
|
k = infer_chaos_kind(p)
|
|
if k:
|
|
kinds.append(k)
|
|
kinds_str = ", ".join(kinds) if kinds else "—"
|
|
return f"{name} ({kinds_str})"
|