Part of the rule testing framework implementation (parent issue: #6503).
Goal
Provide a way for test authors to mock the local filesystem during rule evaluation. This is necessary to test rules that rely on the git ingester, which clones a repository and evaluates its files (e.g., checking for specific .github/workflows/ configurations).
Scope
- Introduce a mechanism in the Starlark testing environment (e.g., a
mock_fs dictionary) to allow users to define file paths and their contents.
- Integrate the mocked filesystem into the evaluation engine so that the
git ingester reads from the mocked files instead of attempting to clone or read from the real local filesystem.
- Add unit tests to verify that rules using the
git ingester can successfully evaluate the mocked filesystem.
Context
As discussed in previous PRs, we have successfully implemented HTTP mocking for the rest ingester. However, the git ingester currently lacks a corresponding mocking layer, meaning test authors cannot verify rules that depend on file contents.
Acceptance Criteria
Part of the rule testing framework implementation (parent issue: #6503).
Goal
Provide a way for test authors to mock the local filesystem during rule evaluation. This is necessary to test rules that rely on the
gitingester, which clones a repository and evaluates its files (e.g., checking for specific.github/workflows/configurations).Scope
mock_fsdictionary) to allow users to define file paths and their contents.gitingester reads from the mocked files instead of attempting to clone or read from the real local filesystem.gitingester can successfully evaluate the mocked filesystem.Context
As discussed in previous PRs, we have successfully implemented HTTP mocking for the
restingester. However, thegitingester currently lacks a corresponding mocking layer, meaning test authors cannot verify rules that depend on file contents.Acceptance Criteria
*.startest scripts.gitingester and returns the mocked contents.