This issue tracks the implementation of the mindev test rule testing framework.
This work is being done as part of my LFX Mentorship project for this term
The design document for this framework has already been discussed and merged in PR #6492.
Implementation Phases
To make the review process smoother, the implementation will be broken down into the following logical phases and PRs:
Open Questions for Reviewers
- Package placement: Does putting the core testing engine logic in
pkg/ruletest (or internal/ruletest) sound good, so it's separate from the CLI boilerplate?
- CLI command: Should the command be just
mindev test or nested like mindev rule test?
This issue tracks the implementation of the
mindev testrule testing framework.This work is being done as part of my LFX Mentorship project for this term
The design document for this framework has already been discussed and merged in PR #6492.
Implementation Phases
To make the review process smoother, the implementation will be broken down into the following logical phases and PRs:
Phase 1: CLI Scaffolding and Test Discovery
cmd/dev/app/test/test.goto register themindev testcobra command.*.starfiles.go.starlark.netexecution environment that loads the files and scans the globals for any function starting withtest_.starlark.Call()and report success/failure.Phase 2: Core Starlark Builtins
pkg/ruletest(orinternal/ruletest) to hold the core testing engine logic.read_file(path)andtxtar(string).checkmodule (check.eq,check.contains) with "expect semantics" (collecting errors in the Starlark thread-local storage rather than aborting immediately).Phase 3: The Mocking Layer
body(payload)andcode(status).http.RoundTripperthat takes a dictionary of URL glob patterns to mock responses, and intercepts outbound requests.Phase 4: Engine Integration &
eval()Builtineval(rule, entity, mocks)to bridge to Minder's rule engine.*.yamlrule definition from the filesystem.http.RoundTripperand mocked filesystem topkg/engine.Evaluate().Open Questions for Reviewers
pkg/ruletest(orinternal/ruletest) sound good, so it's separate from the CLI boilerplate?mindev testor nested likemindev rule test?