auth test: skip unix perm check on Windows
This commit is contained in:
parent
46fb92467d
commit
fecc2ef201
1 changed files with 3 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package auth
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -10,7 +11,7 @@ func TestSaveXVeraeToken(t *testing.T) {
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
t.Setenv("HOME", home)
|
t.Setenv("HOME", home)
|
||||||
t.Setenv("USERPROFILE", home) // os.UserHomeDir on Windows
|
t.Setenv("USERPROFILE", home) // os.UserHomeDir on Windows
|
||||||
t.Setenv("XVERAE_TOKEN", "") // force file path
|
t.Setenv("XVERAE_TOKEN", "") // force file path
|
||||||
if err := SaveXVeraeToken("xVerae-testtoken123"); err != nil {
|
if err := SaveXVeraeToken("xVerae-testtoken123"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +24,7 @@ func TestSaveXVeraeToken(t *testing.T) {
|
||||||
t.Fatalf("%q", b)
|
t.Fatalf("%q", b)
|
||||||
}
|
}
|
||||||
st, _ := os.Stat(p)
|
st, _ := os.Stat(p)
|
||||||
if st.Mode().Perm()&0o077 != 0 {
|
if runtime.GOOS != "windows" && st.Mode().Perm()&0o077 != 0 { // NTFS uses ACLs, not mode bits
|
||||||
t.Fatalf("perms %v", st.Mode())
|
t.Fatalf("perms %v", st.Mode())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue