Files
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

84 lines
2.7 KiB
Python

"""Unit tests for chaos manifest path resolution and ordering (no cluster required)."""
from __future__ import annotations
from pathlib import Path
import pytest
from tests.chaos_engineering.orchestrator import _datadog_values_path
from tests.chaos_engineering.paths import (
CHAOS_ENGINEERING_DIR,
EXPERIMENTS_DIR,
ExperimentNotFoundError,
experiment_chaos_yaml_paths,
experiment_demo_yaml_paths,
experiment_summary_line,
infer_chaos_kind,
list_experiment_names,
validate_experiment,
)
def test_repo_root_contains_datadog_values() -> None:
values = Path(_datadog_values_path())
assert values.is_file(), f"expected {_datadog_values_path()}"
assert values.name == "datadog-values.yaml"
def test_chaos_engineering_dir_exists() -> None:
assert CHAOS_ENGINEERING_DIR.is_dir()
assert (CHAOS_ENGINEERING_DIR / "experiments").is_dir()
def test_list_experiment_names_includes_crashloop() -> None:
names = list_experiment_names()
assert "crashloop" in names
assert "pod-failure" in names
def test_pod_failure_yaml_ordering() -> None:
validate_experiment("pod-failure")
demos = experiment_demo_yaml_paths("pod-failure")
chaos = experiment_chaos_yaml_paths("pod-failure")
assert len(demos) == 1
assert demos[0].name == "pod-failure-demo.yaml"
assert len(chaos) == 1
assert chaos[0].name == "pod-failure-chaos.yaml"
def test_crashloop_has_demo_then_chaos_glob_order() -> None:
validate_experiment("crashloop")
demos = experiment_demo_yaml_paths("crashloop")
chaos = experiment_chaos_yaml_paths("crashloop")
assert [p.name for p in demos] == ["crashloop-demo.yaml"]
assert [p.name for p in chaos] == ["pod-kill-crashloop-chaos.yaml"]
def test_validate_experiment_missing_raises() -> None:
with pytest.raises(ExperimentNotFoundError):
validate_experiment("not-a-real-experiment-dir-xyz")
def test_infer_chaos_kind_first_document(tmp_path: Path) -> None:
y = tmp_path / "x-chaos.yaml"
y.write_text(
"---\n"
"apiVersion: v1\nkind: ConfigMap\nmetadata: {name: a}\n---\n"
"apiVersion: chaos-mesh.org/v1alpha1\nkind: NetworkChaos\nmetadata: {name: n}\n",
encoding="utf-8",
)
assert infer_chaos_kind(y) == "ConfigMap"
def test_experiment_summary_line_pod_failure() -> None:
line = experiment_summary_line("pod-failure")
assert line.startswith("pod-failure")
assert "PodChaos" in line
def test_experiments_dir_matches_list() -> None:
"""Every subdirectory with YAML is listed."""
disk = sorted(p.name for p in EXPERIMENTS_DIR.iterdir() if p.is_dir() and any(p.glob("*.yaml")))
assert list_experiment_names() == disk