Files
home-network-k3s-impl/conformance/tests/l3-fault-injection/alerting/chainsaw-test.yaml
T
jakman85andClaude Opus 4.8 70c0701d6f fix(conformance): block-style chainsaw checks (flow-map broke on contains comma)
My previous commit converted =~ to contains() but kept flow style
'check: { (contains($stdout, 'X')): true }' — the comma inside contains() is a
YAML flow-map separator, so 9 tests failed yamllint ('expected , or }'). Convert
those checks to block style (matching data-survival), where a comma in the key
scalar is fine. Gate PASS; data-survival still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-17 17:02:05 -05:00

56 lines
2.3 KiB
YAML

# =============================================================================
# L3 FAULT-INJECTION SCAFFOLD — Alerting (R-OBS-02, R-OBS-04)
# Catalog: docs/14 "Alerting (R-OBS-02/04, L3)"
#
# GIVEN a monitored condition with a defined alert rule,
# WHEN a fault is INJECTED to trip the condition,
# THEN an email alert is DELIVERED (R-OBS-02) and the dashboard reflects it;
# platform self-health conditions (node/storage/Flux/cert/VPN/backup) also
# alert (R-OBS-04).
#
# R-TEST-05 style: the alert must fire from a real injected fault, not a synthetic
# test-send. Email delivery is asserted via a captured mailbox / SMTP sink fixture
# (no real inbox dependency, hermetic).
#
# STATUS: scaffold — needs T-4.1 (Alertmanager email) + T-4.2 (platform alerts).
# =============================================================================
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: alerting
labels:
conformance.home.k3s/R-OBS-02: "true"
conformance.home.k3s/R-OBS-04: "true"
annotations:
conformance.home.k3s/requirements: "R-OBS-02, R-OBS-04"
conformance.home.k3s/layer: "L3"
conformance.home.k3s/safety-critical: "false"
conformance.home.k3s/intent: >-
Injected fault trips a rule; an email alert is delivered; platform self-health
also alerts.
spec:
steps:
- name: given-monitored-condition-and-mail-sink
try:
- apply:
file: fixtures/smtp-sink.yaml # TODO(T-4.1): hermetic SMTP capture sink
- script:
content: 'echo "TODO: point Alertmanager email route at the in-cluster sink"'
- name: when-inject-fault-to-trip-alert
try:
- script:
content: 'echo "TODO(T-4.2): inject a fault (e.g. crashloop / fill volume) to fire a rule"'
- name: then-email-alert-delivered
try:
- script:
# Poll the SMTP sink (bounded) for a message matching the fired alert.
content: |
set -euo pipefail
echo "TODO: query smtp-sink for an email whose subject matches the alert"
echo "EMAIL_DELIVERED_OK"
check:
(contains($stdout, 'EMAIL_DELIVERED_OK')): true
finally:
- script:
content: 'echo "TODO: clear the injected fault + drain the sink (self-cleaning)"'