03f3585f16
internal/drift/drift.go: Detector (Watch via iter.Seq2, Aggregate,
Remediate with cooldown-on-success, Acknowledge), Config with tiered
cadence (critical 5s + Path units, standard 30s, default 60s).
internal/cli/drift.go: orca drift {show,watch,acknowledge,remediate,
config}. internal/emitter/drift_path.go: systemd Path+service unit
emitter (User=orca, ProtectSystem=strict). scripts/orca-drift-notify.sh
(sha256 event JSON), orca-remediate.sh (cooldown-on-success, transient
retry). Pre-flight gate (R-020, --force + per-ns scoping). orca
system user (REQ-111), NFS detection (D-233), orca job restart for
EnvironmentFile drift (D-235).
---ci---
project: orca
phase: 10b
milestone: v0.11
status: execute
---/ci---
Bash Testing Policy (grill C-15)
Every bash script under scripts/ MUST have at least one bats test covering
the happy path and one covering the failure path. This is the compensating
control for bash being exempt from the Go coverage gate (D-186).
Framework
- bats —
bats scripts/tests/*.bashruns all bash tests. - shellcheck —
shellcheck scripts/*.sh scripts/lib/*.sh scripts/tests/*.bashstatic analysis. - shfmt —
shfmt -d scripts/formatting check (optional; skip if not installed).
Install (if missing)
# bats
npm install -g bats # or: git clone https://github.com/bats-core/bats-core.git && ./bats-core/install.sh /usr/local
# shellcheck
apt-get install -y shellcheck
# shfmt (optional)
mvdan.cc/sh (go install mvdan.cc/sh/v3/cmd/shfmt@latest)
Running
make test-bash # runs bats (skips gracefully if bats missing)
make lint-bash # runs shellcheck + shfmt (skips gracefully if missing)
make test # runs both Go + bash tests
make lint # runs both Go + bash lint
Test file convention
- Test files live in
scripts/tests/<script-name>_test.bash. - Source
load test_helperat the top of every test file. - Happy path:
@test "<script> happy path" { ... } - Failure path:
@test "<script> failure path" { ... } - Use
run <command>+assert_status/assert_contains/assert_not_containsfrom test_helper.