Skip to content

test(hooks): skip stdin JSON test when jq is missing - #4800

Open
onatozmenn wants to merge 1 commit into
docker:mainfrom
onatozmenn:fix/hooks-skip-jq
Open

onatozmenn wants to merge 1 commit into
docker:mainfrom
onatozmenn:fix/hooks-skip-jq

Conversation

@onatozmenn

Copy link
Copy Markdown

printStdinJSONFieldCmd shells out to jq on non-Windows platforms. When jq is absent, the hook still runs and exits cleanly with no output, so the test fails on its content assertion instead of reporting the missing tool. Both tests that use the helper now skip with a reason naming jq.

The Windows helper takes the same *testing.T parameter for signature parity; PowerShell's ConvertFrom-Json is built in, so that variant never skips.

Closes #4052.

Validation:

  • go test ./pkg/hooks/...
  • GOOS=linux GOARCH=amd64 go test -c ./pkg/hooks (compile check for the POSIX helper)
  • go vet ./pkg/hooks/

#4053 proposed the same fix but is stale and has merge conflicts; this is a fresh implementation against current main.

Signed-off-by: onatozmenn <onatozmen44@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:06
@onatozmenn
onatozmenn requested a review from a team as a code owner November 3, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@aheritier aheritier added area/testing Test infrastructure, CI/CD, test runners, evaluation kind/test Test-only changes labels Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Test infrastructure, CI/CD, test runners, evaluation kind/test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkg/hooks tests fail with a misleading assertion when jq is not installed

3 participants