]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/config/files_test.go
tests: use filetest.CreateFifo() in config tests
[safcm/safcm.git] / cmd / safcm / config / files_test.go
index 6124e8ad93b8a2b48eb59ad658b3689251096eeb..cc963c94a232ea3df776c11b45c76500f06ce110 100644 (file)
@@ -20,10 +20,10 @@ import (
        "io/fs"
        "os"
        "runtime"
-       "syscall"
        "testing"
 
        "ruderich.org/simon/safcm"
+       ft "ruderich.org/simon/safcm/cmd/safcm-remote/sync/filetest"
        "ruderich.org/simon/safcm/testutil"
 )
 
@@ -47,8 +47,8 @@ func TestLoadFiles(t *testing.T) {
        }
 
        // Regular users cannot create sticky files
-       skipInvalidSticky := runtime.GOOS == "freebsd" ||
-               runtime.GOOS == "openbsd"
+       skipInvalidSticky := os.Getuid() != 0 &&
+               (runtime.GOOS == "freebsd" || runtime.GOOS == "openbsd")
 
        chmod("files-invalid-perm-dir/files", 0500)
        defer chmod("files-invalid-perm-dir/files", 0700)
@@ -69,10 +69,7 @@ func TestLoadFiles(t *testing.T) {
                chmod("files-invalid-perm-file-sticky/files/etc/resolv.conf", 01644)
        }
 
-       err = syscall.Mkfifo("files-invalid-type/files/invalid", 0644)
-       if err != nil {
-               t.Fatal(err)
-       }
+       ft.CreateFifo("files-invalid-type/files/invalid", 0644)
        defer os.Remove("files-invalid-type/files/invalid")
 
        const errMsg = `