Manual Test Runbook — D3 + X3: OPA / Conftest Policy Bundle
Owner: Sagar | Time: ~20 min | Sandbox: none (purely local)
D3 ships the SnowOps OPA bundle (policy/opa/rules/). X3 ships the
test suite (policy/opa/tests/). This runbook validates both —
unit tests via conftest verify, and end-to-end via conftest test
against the committed fixture plans.
Prerequisites
- Local tooling:
conftest >= 0.56(brew install confteston macOS, or grab the binary from https://github.com/open-policy-agent/conftest/releases).gitconfigured to use the repo's hooks.
- Working directory: repo root.
- Clean working tree.
Steps
Part A — conftest verify: the bundle's own tests (~3 min)
- Run the policy-side unit tests:
- Expected:
36 tests, 36 passed, 0 warnings, 0 failures, 0 exceptions, 0 skipped. Coverage breakdown (6 + 4 + 8 + 7 + 8 + 3 = 36): tags_test.rego— 6 testslocations_test.rego— 4 testsnetwork_test.rego— 8 testsencryption_test.rego— 7 testscost_test.rego— 8 tests-
integration_test.rego— 3 cross-category tests -
If a test fails, fix the rule and the test before re-running.
Part B — conftest test against the clean fixture (~3 min)
- Confirm the bundle reports zero findings on a fully-compliant plan:
- Expected:
14 tests, 14 passed, 0 warnings, 0 failures, 0 exceptions. Exit code0.
Part C — conftest test against the bad-plan fixture (~3 min)
- Confirm the bundle catches the planted violations:
- Expected: 9 failures, one or more per category:
snowops.tags— 1 finding (missing tags on the untagged RG)snowops.locations— 1 finding (brazilsouth)snowops.network— 3 findings (storagepublic_network_access_enabled=true, storageallow_nested_items_to_be_public=true, NSG SSH-from-internet)snowops.encryption— 2 findings (storagemin_tls_version=TLS1_0, storagehttps_traffic_only_enabled=false)snowops.cost— 2 findings (legacyazurerm_postgresql_server, M-series VM)- Exit code non-zero (Conftest exits
1whenever any deny fires).
Part D — pre-push hook smoke test (~3 min)
- Confirm the pre-push hook wires conftest in:
pip install pre-commit
pre-commit install --install-hooks
pre-commit run conftest-verify --all-files --hook-stage pre-push
- Expected: hook executes
conftest verifyand exits0. If conftest is not onPATH, the hook fails immediately — install it first.
Part E — D2 CI job (~5 min, optional, requires push to GitHub)
-
From a feature branch, push any change and open a PR. The
quality-gates / conftest verify (policy/opa)job must run alongside the other five gates and report ✅. -
Optional negative test: introduce a deliberately broken assertion in a test file (e.g., change
count(deny) == 0tocount(deny) == 1in a clearly-passing test), push, and confirm the CI job fails on the PR. Revert before merging.
Pass criteria
-
conftest verifyreports 36/36 tests passing. -
conftest testonclean_plan.jsonexits0with no findings. -
conftest testonbad_plan.jsonexits non-zero with at least one finding from each of the fivesnowops.*categories. -
pre-commit run conftest-verify --hook-stage pre-pushsucceeds locally. - (Optional)
quality-gates / conftest verify (policy/opa)job passes on a clean PR; fails on a planted-bad-rule PR.
Teardown
D3+X3 have no cloud side-effects. If you mutated a test file for Part E, revert it before merging:
Sign-off
- Tester: _ | Date: _ | Result: PASS / FAIL / N/A
- Notes: