Skip to content

Commit f792f2b

Browse files
fix windows test failure
1 parent 5356010 commit f792f2b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

internal/migration/v2shim_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package migration
33
import (
44
"os"
55
"path/filepath"
6+
"runtime"
67
"testing"
78
)
89

@@ -101,8 +102,11 @@ exec "goenv" "$@"
101102
})
102103

103104
t.Run("returns error when removal fails", func(t *testing.T) {
104-
// This test is platform-dependent and may not work in all environments
105-
// Skip if we can't create a read-only directory
105+
// Skip on Windows - Unix permission model doesn't apply
106+
if runtime.GOOS == "windows" {
107+
t.Skip("Skipping permission test on Windows - different permission model")
108+
}
109+
106110
shimPath := filepath.Join(shimsDir, "goenv")
107111
v2Content := `#!/usr/bin/env bash
108112
exec "/opt/homebrew/Cellar/goenv/2.2.38_1/libexec/goenv" "$@"
@@ -111,9 +115,9 @@ exec "/opt/homebrew/Cellar/goenv/2.2.38_1/libexec/goenv" "$@"
111115
t.Fatalf("Failed to create shim: %v", err)
112116
}
113117

114-
// Make directory read-only (Unix-like systems)
118+
// Make directory read-only (Unix-like systems only)
115119
if err := os.Chmod(shimsDir, 0555); err != nil {
116-
t.Skip("Cannot test permission error on this platform")
120+
t.Skipf("Cannot test permission error: %v", err)
117121
}
118122
defer os.Chmod(shimsDir, 0755) // Restore permissions
119123

0 commit comments

Comments
 (0)