From b5843ab43f2f3453f3f1ae07332adfda5f7e2bb8 Mon Sep 17 00:00:00 2001 From: Dai Ha Date: Sat, 12 Sep 2026 11:50:11 +0700 Subject: [PATCH] fleetd #519 review fix: widen two needles to the whole parenthetical MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both arity assertions matched on `jq) returned N field(s)` — a needle that starts in the middle of the script's `(parser name)` parenthetical. On a real failure the harness prints `missing `, so the line came out as: FAIL: empty parser output count: missing jq) returned 0 field(s) which reads as if the script's own message had an unbalanced paren. It does not; the needle was just sliced. Matching on `policy parser (jq) returned N field(s)` makes the failure readable and also pins that the refusal names the parser it used, which the narrower needle did not. make_jq() PATH-prefixes a fake jq, so `_PARSER_NAME` is deterministically "jq" in both tests; the wider needle cannot flake on a host without jq. Re-proved on this revision, because a disproof is about a revision and not a file: * suite exit 0, "PASS: probe member credentials guards" * bash -n rc=0 on the test under /bin/bash 3.2.57 and bash 5.3.9 * dropping the empty-parse special case -> FAIL: empty parser output count: missing policy parser (jq) returned 0 field(s) * arity threshold 5 -> 0 -> FAIL: short parser output status * script restored byte-identical after each, green control after both --- scripts/test-probe-member-credentials.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/test-probe-member-credentials.sh b/scripts/test-probe-member-credentials.sh index 477c60b..613e1c8 100755 --- a/scripts/test-probe-member-credentials.sh +++ b/scripts/test-probe-member-credentials.sh @@ -62,14 +62,14 @@ test_short_parser_output_refuses() { make_jq "printf '%s\\n' true enforce 3 2" run_parser assert_equals 5 "$PARSER_RC" "short parser output status" - assert_contains 'jq) returned 4 field(s)' "$PARSER_OUTPUT" "short parser output count" + assert_contains 'policy parser (jq) returned 4 field(s)' "$PARSER_OUTPUT" "short parser output count" } test_empty_parser_output_reports_zero_fields() { make_jq ':' run_parser assert_equals 5 "$PARSER_RC" "empty parser output status" - assert_contains 'jq) returned 0 field(s)' "$PARSER_OUTPUT" "empty parser output count" + assert_contains 'policy parser (jq) returned 0 field(s)' "$PARSER_OUTPUT" "empty parser output count" } test_well_formed_policy_prints_name_table() {