Skip to content

fix(gcsfs): honor TestMain exit code from m.Run - #683

Closed
00200200 wants to merge 1 commit into
spf13:masterfrom
00200200:fix/gcsfs-testmain-exit-code
Closed

00200200 wants to merge 1 commit into
spf13:masterfrom
00200200:fix/gcsfs-testmain-exit-code

Conversation

@00200200

@00200200 00200200 commented Oct 5, 2026

Copy link
Copy Markdown

Summary

  • defer os.Exit(exitCode) in gcsfs TestMain evaluated exitCode at defer registration time (always 0), so failed tests and panic recovery still exited successfully.
  • Exit via defer func() { os.Exit(exitCode) }() so the final value from m.Run() / recover is used and CI reports failures correctly.

Fixes #681

Test plan

  • Before fix: TestGcsReaddir / TestGcsReaddirnames / TestGcsGlob fail in output but go test exits 0
  • After fix: same failures exit 1
  • Passing subset (TestGcsFsOpen|Read|Seek|Name|Close|FsStat|Mkdir|UploadChunkSize) still exits 0
  • Note: this intentionally surfaces the existing three mocked-directory failures; fixing those is out of scope here (see also Map the empty path to the root like "." and ".." #679)

defer os.Exit(exitCode) captured the zero value at registration time,
so failed tests and panic recovery still exited 0. Exit via a closure
so CI fails when gcsfs tests fail.

Fixes #681
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@00200200

00200200 commented Oct 5, 2026

Copy link
Copy Markdown
Author

Closing this PR as I will not be signing the CLA. Thank you!

@00200200 00200200 closed this Oct 5, 2026
@00200200
00200200 deleted the fix/gcsfs-testmain-exit-code branch October 5, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gcsfs tests exit successfully when tests fail

2 participants