From 6dfcf7ac1df18f5ecbe70e9272e1669556712e6e Mon Sep 17 00:00:00 2001 From: aaronjmars Date: Fri, 11 Sep 2026 14:13:28 -0400 Subject: [PATCH] fix(tests): make vuln-scanner status test tolerant of the timeout-aware block PR #1055 wrapped the filesystem trufflehog status echo in a timeout-aware if/else (the =124 guard mirrors the git-history block), which indented the line and added a sibling `trufflehog=timeout` echo. The contract test still matched `line.startswith('echo "trufflehog=')` at column 0, so it hit StopIteration and ci-tests went red on every PR that touches a ci-tests path. Select the RC-driven ok/fail echo by its expression and strip the indentation before running it, so the test tracks the restructured shape without asserting a specific indentation. No behavior change to the skill. --- scripts/tests/test_vuln_scanner_status.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/tests/test_vuln_scanner_status.py b/scripts/tests/test_vuln_scanner_status.py index 36ad4774a64..39f75e9e2cf 100644 --- a/scripts/tests/test_vuln_scanner_status.py +++ b/scripts/tests/test_vuln_scanner_status.py @@ -24,7 +24,15 @@ def test_history_status_uses_exit_code_not_finding_count(self): self.assertEqual(rows[-1], f"trufflehog-git={expected}") def test_filesystem_clean_empty_stream_is_ok(self): - row = next(line for line in SKILL.splitlines() if line.startswith('echo "trufflehog=')) + # The filesystem trufflehog status is the RC-driven ok/fail echo. It now lives + # inside a timeout-aware if/else (the `=124` guard mirrors the git block), so it + # is indented and sits alongside a sibling `trufflehog=timeout` line - select it + # by its ok/fail expression and strip the indentation before running it. + row = next( + line.strip() + for line in SKILL.splitlines() + if line.strip().startswith('echo "trufflehog=') and "&& echo ok" in line + ) with tempfile.TemporaryDirectory() as directory: for rc, expected in [(0, "ok"), (1, "fail")]: subprocess.run(["bash", "-c", f"TRUFFLEHOG_RC={rc}\n" + row.replace("/tmp/vuln-scan", directory)], check=True)