# ============================================================================= # 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: { ($stdout =~ 'EMAIL_DELIVERED_OK'): true } finally: - script: content: 'echo "TODO: clear the injected fault + drain the sink (self-cleaning)"'