Description
pkg/hooks has one test helper that needs a JSON parser in the shell:
func printStdinJSONFieldCmd(field string) string {
return `cat | jq -r '.` + field + `'`
}
jq is not part of the Go toolchain and is absent from stock container images
(golang:1.27 does not ship it). When it is missing the hook still runs and exits cleanly — it
just produces no output — so the test does not fail on "command not found". It fails later, on
its content assertion, with an error that points at the hook plumbing instead of at the machine.
Expected Behavior
A missing external tool is reported as a missing external tool: the test skips with a reason
naming jq, and the package still reports ok.
Actual Behavior
TestExecuteStopReceivesResponseContent fails with:
"" does not contain "final answer content"
Nothing in that message mentions jq. It reads as "the stop hook is not receiving the response
content", i.e. a product defect in hook input plumbing.
Steps to Reproduce
- Use a machine or container without
jq (e.g. the stock golang:1.27 image).
go test ./pkg/hooks/
- Observe the failure above.
Docker Agent version
No response
OS & terminal
No response
Model used
No response
Error output
=== RUN TestExecuteStopReceivesResponseContent
hooks_test.go:586:
Error Trace: pkg/hooks/hooks_test.go:586
Error: "" does not contain "final answer content"
Test: TestExecuteStopReceivesResponseContent
--- FAIL: TestExecuteStopReceivesResponseContent (0.00s)
FAIL github.com/docker/docker-agent/pkg/hooks 20.059s
Confirmed as environmental, not a regression — it reproduces on unmodified `main`
(`f2807d1bb`), 3 runs out of 3, and disappears the moment `jq` is installed.
Screenshots
No response
Additional context
The cost of this is diagnostic time spent in the wrong place. Found while verifying an unrelated
branch: the failure was initially read as a merge regression, and it took a baseline run against
untouched main plus tracing the helper to identify a missing package as the cause.
It also makes the package quietly hostile to contributors whose machines lack jq — the first
run of the suite reports what looks like a real bug.
Only one test uses the helper, so the blast radius is small and the fix is contained.
Description
pkg/hookshas one test helper that needs a JSON parser in the shell:jqis not part of the Go toolchain and is absent from stock container images(
golang:1.27does not ship it). When it is missing the hook still runs and exits cleanly — itjust produces no output — so the test does not fail on "command not found". It fails later, on
its content assertion, with an error that points at the hook plumbing instead of at the machine.
Expected Behavior
A missing external tool is reported as a missing external tool: the test skips with a reason
naming
jq, and the package still reportsok.Actual Behavior
TestExecuteStopReceivesResponseContentfails with:Nothing in that message mentions
jq. It reads as "the stop hook is not receiving the responsecontent", i.e. a product defect in hook input plumbing.
Steps to Reproduce
jq(e.g. the stockgolang:1.27image).go test ./pkg/hooks/Docker Agent version
No response
OS & terminal
No response
Model used
No response
Error output
=== RUN TestExecuteStopReceivesResponseContent hooks_test.go:586: Error Trace: pkg/hooks/hooks_test.go:586 Error: "" does not contain "final answer content" Test: TestExecuteStopReceivesResponseContent --- FAIL: TestExecuteStopReceivesResponseContent (0.00s) FAIL github.com/docker/docker-agent/pkg/hooks 20.059s Confirmed as environmental, not a regression — it reproduces on unmodified `main` (`f2807d1bb`), 3 runs out of 3, and disappears the moment `jq` is installed.Screenshots
No response
Additional context
The cost of this is diagnostic time spent in the wrong place. Found while verifying an unrelated
branch: the failure was initially read as a merge regression, and it took a baseline run against
untouched
mainplus tracing the helper to identify a missing package as the cause.It also makes the package quietly hostile to contributors whose machines lack
jq— the firstrun of the suite reports what looks like a real bug.
Only one test uses the helper, so the blast radius is small and the fix is contained.