Skip to content

testing: make unit test expectations portable - #675

Open
massimomazzariol wants to merge 1 commit into
hashicorp:mainfrom
massimomazzariol:fix-windows-test-portability
Open

testing: make unit test expectations portable#675
massimomazzariol wants to merge 1 commit into
hashicorp:mainfrom
massimomazzariol:fix-windows-test-portability

Conversation

@massimomazzariol

Copy link
Copy Markdown

Summary

  • Build expected test paths with filepath.Join instead of hard-coded / separators.
  • Replace platform-specific error-message regexes with structured error checks using errors.Is and errors.As.
  • Normalize CRLF line endings before comparing appended configuration content.
  • Add a Changie entry for the fix.

Closes #673.

Testing

The affected packages were tested locally on Windows 11 with both supported Go versions:

go1.25.12: go test ./config ./internal/teststep -count=1
go1.26.5:  go test ./config ./internal/teststep -count=1

Both passed.

Linux behavior was also validated from the Windows development machine using Docker. The same package tests were run from a Linux filesystem checkout inside the official golang:1.25.12 and golang:1.26.5 images, rather than directly against the Windows bind mount, so Linux file permissions and path behavior were exercised normally. Both container runs passed.

@massimomazzariol
massimomazzariol requested a review from a team as a code owner July 24, 2026 19:58
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.

Go unit tests use Unix-specific path, error, and newline expectations on Windows

1 participant