Skip to content

test: correct Windows permission and listener expectations - #4913

Open
ws-cczj wants to merge 1 commit into
gin-gonic:masterfrom
ws-cczj:fix/windows-test-expectations
Open

ws-cczj wants to merge 1 commit into
gin-gonic:masterfrom
ws-cczj:fix/windows-test-expectations

Conversation

@ws-cczj

@ws-cczj ws-cczj commented Oct 26, 2026 •

Copy link
Copy Markdown

Four existing tests fail on Windows/amd64 with Go 1.26.2 because they assume Unix permission semantics or expect a TCPListener.File error that no longer occurs. The same failures reproduce on unmodified master (0f09c3a).

Keep uploaded-file content checks on all platforms, and run the exact Unix permission check in a subtest that explicitly skips Windows. Skip the directory-search-permission failure case on Windows, where those permission bits are not enforced. Compare an existing directory's actual permissions before and after saving instead of assuming Windows reports 0700.

Require TCPListener.File to succeed and exercise the existing RunFd HTTP response checks on Windows as well. Close the listener and duplicated file when the test finishes.

No production code, dependency, or workflow changes are included.

Validation on Windows/amd64, Go 1.26.2:

  • Before: all four targeted tests fail on unchanged master.
  • After: file content, existing-directory state, and RunFd HTTP assertions pass. The Unix-only permission-error test and exact-mode subtest explicitly skip Windows.
  • go test ./... -count=1, go test ./... -count=1 -tags nomsgpack, and go test ./... -count=1 -race: passed, without command-line skips.
  • go vet ./...: passed.
  • golangci-lint v2.11.0 run --timeout 5m --new-from-rev upstream/master: 0 issues.
  • Current-commit CI: all 20 Linux/macOS combinations of Go 1.26/1.27 and default, nomsgpack, Sonic, go_json, and race passed, along with lint, CodeQL, and Codecov. Run Tests. Existing dependency security findings are unchanged.

Pull Request Checklist

  • Open your pull request against the master branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.
  • If the pull request introduces a new feature, the feature is documented in the docs/doc.md. (Not applicable: tests only.)

Known baseline: Trivy reports five vulnerabilities in unchanged golang.org/x/net v0.57.0; the official master scan reports the same findings. The full-CI checklist item remains unchecked.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (0f09c3a) to head (21b448a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4913   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files          48       48           
  Lines        3188     3188           
=======================================
  Hits         3145     3145           
  Misses         43       43           
Flag Coverage Δ
--ldflags="-checklinkname=0" -tags sonic 98.64% <ø> (ø)
-tags go_json 98.57% <ø> (ø)
-tags nomsgpack 98.63% <ø> (ø)
go-1.26 98.33% <ø> (ø)
go-1.27 98.67% <ø> (ø)
macos-latest 98.65% <ø> (ø)
ubuntu-latest 98.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant