akua test
Planned
Run unit tests for packages, policies, or both. Unified test runner across engines — detects target types by file extension.
akua test [path] [flags]
Discovers and runs:
**/*_test.rego— Rego policy tests via embedded OPA**/_test.k/test_.k— KCL test files via embedded KCL- Kyverno
test.yamlbundle tests (when the bundle is imported) - Golden-output tests (
*.golden.yamlcompared against current render)
Flags
| flag | description | ||
|---|---|---|---|
--coverage | emit per-rule / per-schema coverage report | ||
--watch | re-run on file change | ||
--golden | enable / verify golden-output comparisons | ||
--filter=<regex> | run only matching tests | ||
--timeout=<dur> | per-test timeout (default 30s) | ||
| `--engine=<auto\ | embedded\ | shell>` | engine selection (see embedded-engines.md) |
Exit codes
0 if all pass, 1 if any fail, 2 on infrastructure error.
JSON output
{
"summary": { "passed": 24, "failed": 1, "skipped": 2, "duration_ms": 413 },
"results": [
{
"file": "policies/production_test.rego",
"test": "test_deny_missing_team_label",
"status": "pass",
"duration_ms": 12
},
{
"file": "packages/api/test_api.k",
"test": "test_default_replicas",
"status": "fail",
"message": "expected replicas=3, got 1",
"duration_ms": 8
}
],
"coverage": { "overall": 0.72, "by_rule": { "deny_budget_exceeded": 0.0 } }
}