5f92196625
tests/integration/harness.go: temp ORCA_HOME + mock peers + helpers. tests/integration/scenarios_test.go: ns-create/job-submit/drain/backup/ secrets/acl/metrics scenarios. drift_scenarios_test.go: 4 stubs (auto- remediation, NFS, cooldown, secret exclusion) skip until P10b. scripts/tests/orca-commands_test.bash: bats for new CLI commands. ---ci--- project: orca phase: 08 milestone: v0.11 status: execute ---/ci---
81 lines
3.1 KiB
Go
81 lines
3.1 KiB
Go
package integration
|
|
|
|
import "testing"
|
|
|
|
// Drift-detection integration test stubs (P08, REQ-087). The drift
|
|
// detection code itself lands in P10b; these stubs define the scenarios
|
|
// and skip with a clear message so the integration suite is green until
|
|
// P10b ships. Each stub exercises the hermetic harness (NewHarness) and
|
|
// the mock peer transport, so when the P10b implementation lands the
|
|
// stubs can be filled in without re-architecting the test scaffolding.
|
|
|
|
// TestScenario_DriftAutoRemediation verifies that editing a Traefik
|
|
// config file on a peer is detected as drift within ~10s and
|
|
// auto-remediated back to the canonical state.
|
|
//
|
|
// Scenario:
|
|
// 1. Harness registers a peer with a canonical Traefik config.
|
|
// 2. An external "edit" mutates the config on the peer.
|
|
// 3. The drift detector polls the peer, detects the divergence, and
|
|
// rewrites the canonical config.
|
|
// 4. The test asserts the peer's config matches the canonical state
|
|
// and a drift event was recorded.
|
|
//
|
|
// Requires P10b drift detection.
|
|
func TestScenario_DriftAutoRemediation(t *testing.T) {
|
|
t.Skip("requires P10b drift detection — will be implemented after P10b ships")
|
|
_ = NewHarness(t)
|
|
}
|
|
|
|
// TestScenario_DriftNFSFallback verifies that when a peer's NFS mount
|
|
// is unavailable, the drift detector falls back from Path-unit
|
|
// inotify watching to polling, and still detects drift.
|
|
//
|
|
// Scenario:
|
|
// 1. Harness registers a peer with Path units enabled (inotify mode).
|
|
// 2. The peer's NFS mount is simulated as unavailable.
|
|
// 3. The detector disables Path units and switches to polling.
|
|
// 4. A config edit is detected via the polling loop.
|
|
//
|
|
// Requires P10b drift detection.
|
|
func TestScenario_DriftNFSFallback(t *testing.T) {
|
|
t.Skip("requires P10b drift detection — will be implemented after P10b ships")
|
|
_ = NewHarness(t)
|
|
}
|
|
|
|
// TestScenario_DriftRateLimitCooldown verifies that repeated drift
|
|
// events on a peer trigger a cooldown that blocks the remediation loop
|
|
// (rate-limit) so a flapping config does not hot-loop the detector.
|
|
//
|
|
// Scenario:
|
|
// 1. Harness registers a peer.
|
|
// 2. A config is mutated repeatedly beyond the rate-limit threshold.
|
|
// 3. The detector enters cooldown and skips remediation until the
|
|
// cooldown window elapses.
|
|
// 4. The test asserts a cooldown event was recorded and no
|
|
// remediation ran during the window.
|
|
//
|
|
// Requires P10b drift detection.
|
|
func TestScenario_DriftRateLimitCooldown(t *testing.T) {
|
|
t.Skip("requires P10b drift detection — will be implemented after P10b ships")
|
|
_ = NewHarness(t)
|
|
}
|
|
|
|
// TestScenario_DriftSecretExclusion verifies that editing a file under
|
|
// /etc/orca/credentials/* does NOT emit a drift event (secrets are
|
|
// excluded from drift detection so credential rotation does not trip
|
|
// remediation).
|
|
//
|
|
// Scenario:
|
|
// 1. Harness registers a peer with credentials under
|
|
// /etc/orca/credentials/.
|
|
// 2. A credential file is mutated.
|
|
// 3. The test asserts no drift event was recorded for the credentials
|
|
// path.
|
|
//
|
|
// Requires P10b drift detection.
|
|
func TestScenario_DriftSecretExclusion(t *testing.T) {
|
|
t.Skip("requires P10b drift detection — will be implemented after P10b ships")
|
|
_ = NewHarness(t)
|
|
}
|