mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-05 16:02:12 +00:00
fix(test): skip POSIX permission assertions on Windows
Windows has no POSIX permission bits: os.WriteFile mode is ignored and files report 0666-style permissions, so the 0600 assertions in the qualityguard bootstrap and runtime-config tests always fail on Windows. Skip them on Windows; POSIX behavior is unchanged. (cherry picked from commit 0b9d0487b066472d33755c531b6f3f6a5c0da8ab)
This commit is contained in:
1 parent
725ecf0899
commit
75fa94f88c
2 files changed
+8
-2
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -31,7 +32,9 @@ func TestPrepareWritesPrivateScopedBootstrap(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if info.Mode().Perm() != 0o600 {
|
||||
// Windows has no POSIX permission bits: the os.WriteFile mode argument
|
||||
// is ignored and files always report 0666-style permissions.
|
||||
if runtime.GOOS != "windows" && info.Mode().Perm() != 0o600 {
|
||||
t.Fatalf("mode = %o", info.Mode().Perm())
|
||||
}
|
||||
var payload bootstrapFile
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -120,7 +121,9 @@ func TestUpdateQualityGuardConfigWritesPrivateAtomicFile(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if info.Mode().Perm() != 0o600 {
|
||||
// Windows has no POSIX permission bits: the os.WriteFile mode argument
|
||||
// is ignored and files always report 0666-style permissions.
|
||||
if runtime.GOOS != "windows" && info.Mode().Perm() != 0o600 {
|
||||
t.Fatalf("runtime config mode = %o", info.Mode().Perm())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user