Fix false test failures caused by Ginkgo reporter output on stdout#72
Fix false test failures caused by Ginkgo reporter output on stdout#72anuragthehatter wants to merge 1 commit into
Conversation
When running multiple tests, SpawnProcessToRunTest re-execs the binary
with `run-test --output=json` and expects pure JSON on stdout. However,
Ginkgo's default reporter writes its banner ("Running Suite:...",
"SUCCESS!...") to stdout even though GinkgoWriter is redirected to
stderr. This non-JSON text precedes the JSON result and causes
json.Unmarshal to fail with "invalid character 'S' looking for
beginning of value", making passing tests appear as failures.
Fix by stripping any leading non-JSON bytes from stdout before
attempting to unmarshal. Also fix a minor format string bug where
%v was used instead of %d for an integer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: anuragthehatter The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@anuragthehatter: This PR was included in a payload test run from openshift/ovn-kubernetes#3200 |
|
openshift/origin is the orchestrator in CI. Code here is used when OTE is standalone as a convenience or when using OTE outside of openshift-tests. You should confirm OTE is the source of the problem, are you seeing it locally in testing or in CI jobs? |
|
I tried to reproduce the bug described here but couldn't find a code path where the Ginkgo reporter banner ends up on stdout. What I checked:
Question: Could you provide a specific reproducer? The orchestration layers in origin may differ from example-tests — is the issue specific to how origin wires up the Ginkgo suite or spawns subprocesses? If so, noting which binary/suite triggers it would help confirm the fix. The fix itself is defensive and reasonable, but I'd like to understand the actual trigger before adding integration tests for it. |
|
Update after scanning openshift/origin: Origin's
So the question remains: in what scenario does the Ginkgo banner actually end up on stdout in Is this perhaps triggered by a specific extension binary that doesn't call |
|
@stbenjam Thanks for replying. Not an expert in this area but got his from AI alibi. I am also trying few runs on openshift/ovn-kubernetes#3200 to see if that specific failed cases issue is still a repro. |
|
ovn is using quite old openshift-test-extension, last commit in January, I would try to revendor it. We also fixed some things in onsi-ginkgo around outptu: openshift/onsi-ginkgo#23 |
|
Thanks @stbenjam Filed openshift/ovn-kubernetes#3250. |
|
@stbenjam Any thought on this PR wrt openshift/ovn-kubernetes#3200 (comment) ? |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Summary
SpawnProcessToRunTestre-execs the binary withrun-test --output=jsonand expects pure JSON on stdoutRunning Suite:...,SUCCESS!...) to stdout even thoughGinkgoWriteris redirected to stderr viaginkgo.NewWriter(os.Stderr)inconfigureGinkgo()json.Unmarshalto fail withinvalid character 'S' looking for beginning of valueDeserialization ErrorHow to reproduce
Run any OTE extension with concurrency > 1:
All tests pass in Ginkgo (
SUCCESS! -- 1 Passed) but the harness reports them as failed.Test plan
go test ./pkg/ginkgo/)go build ./pkg/ginkgo/)🤖 Generated with Claude Code