Repository navigation
test(scan): fake the scanners in the scan command tests - #4440
Conversation
test_scan_individual_tools and the three cases of test_scan_serialized_output_holds_status_reason_and_findings ran devops scan trivy, secrets and sast with no fake. In the devcontainer the real trivy, gitleaks and semgrep are on PATH, and the floor of the suite refused them: 4 failures and 4 errors. On the GitHub runner no scanner is on PATH, so each scan reported unavailable and the tests tested no scan that ran. The tests now ask for scanner_fake, which puts a stand-in for each scanner on PATH and answers it at the tool executor seam. They script a Trivy run that finds nothing, because the fake has no recorded Trivy run. They assert the full output of a clean scan and the scanner that each command started. The result is the same with and without the scanners on the host. Closes #4321
|
Test evidence for this change (devcontainer, branch rebased on Fail-to-pass. The defect is in the old tests. With the test file of
With this change:
I did not run the full local The guard that would stop the next test of this type on the GitHub runner is out of scope here. It is filed as #4439. |
Two tests of tests/commands/test_scan.py ran devops scan trivy, secrets and sast with no fake. In the devcontainer the real scanners are on PATH, and the floor refused them: 4 failures and 4 errors in each full local CI run. On the GitHub runner no scanner is on PATH, so each scan reported unavailable and the tests tested no scan that ran. The tests now use scanner_fake, script a clean Trivy run, and assert the full output and the scanner that each command started. The result is the same with and without the scanners on the host. It also delivers #4288.
Closes #4321
Change:
openspec/changes/archive/2026-11-11-4321-fake-the-scanners-in-the-scan/