fix(test): run subprocess before reading stdout/stderr buffers#40
Merged
fullstackjam merged 2 commits intomainfrom Apr 21, 2026
Merged
fix(test): run subprocess before reading stdout/stderr buffers#40fullstackjam merged 2 commits intomainfrom
fullstackjam merged 2 commits intomainfrom
Conversation
TestE2E_Publish_UpdateViaSyncSource asserts the "Publishing to @user/slug (updating)" message lands on stderr, but ui.Info prints via fmt.Println to stdout. Every other line in publishSnapshot (surrounding blank lines, the final success marker) already goes through os.Stderr, so the ui.Info calls were the lone stream mismatch and blocked the destructive-test gate in the release workflow since v0.55.1. Write both publish-status lines directly to os.Stderr, matching the rest of the publish output stream and unblocking releases.
runBinary captured outBuf.String() and errBuf.String() in the same return statement as cmd.Run(), causing Go to evaluate the buffer reads left-to-right *before* the subprocess executed. Both captures returned empty strings regardless of what the binary printed. Split into two statements: run first, then read the buffers. Also keep the companion fix from the prior commit: route the "Publishing to @user/slug" banner to os.Stderr so it appears on the stream the test asserts against.
|
👋 Thanks for opening this pull request! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the persistent
TestE2E_Publish_UpdateViaSyncSourcefailure that has blocked every release since v0.55.1.Root cause:
runBinaryhad a subtle Go evaluation-order bug:Go evaluates return expressions left-to-right, so
outBuf.String()anderrBuf.String()were captured beforecmd.Run()executed the subprocess. Both always returned"".Why the test failed:
TestE2E_Publish_UpdateViaSyncSourceassertsassert.Contains(t, stderr, "bob/my-env")— but stderr was always""regardless of what the binary printed. The companion fix in the prior commit (routing the banner toos.Stderr) is correct and still needed; this commit makes the test actually capable of observing it.Test plan
gate-tests→ Destructive tests passes on macos-latestTestE2E_Publish_UpdateViaSyncSourcepasses