Skip to content

Commit 398dd87

Browse files
committed
test: the cache permission check is POSIX-only
The Windows leg of the matrix caught this: os.Stat there synthesises 0666/0777 and only the read-only flag round-trips, so the 0600/0700 the code passes is unobservable and the assertion could never hold. Skipped with that reason rather than weakened — on Windows the protection comes from the ACL that %LocalAppData% (os.UserCacheDir) already restricts to the user, not from mode bits. beep boop
1 parent cbed4c6 commit 398dd87

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/cache/cache_test.go

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

@@ -95,6 +96,13 @@ func TestLoadMissIsEmptyNotNil(t *testing.T) {
9596
// not secrets, but nothing else on this machine needs them either, and the
9697
// CLI writes nothing else to disk.
9798
func TestMergeWritesPrivately(t *testing.T) {
99+
if runtime.GOOS == "windows" {
100+
// Windows has no POSIX mode bits: os.Stat synthesises 0666/0777 and
101+
// only the read-only flag round-trips, so the modes we pass are
102+
// unobservable. Access there comes from the ACL that %LocalAppData%
103+
// (os.UserCacheDir) already restricts to the user.
104+
t.Skip("file modes are not POSIX on Windows")
105+
}
98106
// Given
99107
isolate(t)
100108

0 commit comments

Comments
 (0)