Windows: Skip "inaccessible path" test

For some reason, on Windows, creating a directory with zero permissions
still allows creating a file in there. Just skip that part of the test.

The Explorer's properties panel of the directory also shows "Read Only
(only applies to files)", so at least that seems consistent.
This commit is contained in:
Sybren A. Stüvel 2022-07-16 10:31:20 +02:00
parent 859a261b05
commit ca586bf3fe

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"testing" "testing"
"git.blender.org/flamenco/internal/manager/config" "git.blender.org/flamenco/internal/manager/config"
@ -98,7 +99,12 @@ func TestCheckSharedStoragePath(t *testing.T) {
} }
// Test inaccessible path. // Test inaccessible path.
{ // For some reason, this doesn't work on Windows, and creating a file in
// that directory is still allowed. The Explorer's properties panel of the
// directory also shows "Read Only (only applies to files)", so at least
// that seems consistent.
// FIXME: find another way to test with unwritable directories on Windows.
if runtime.GOOS != "windows" {
parentPath := filepath.Join(mf.tempdir, "deep") parentPath := filepath.Join(mf.tempdir, "deep")
testPath := filepath.Join(parentPath, "nesting") testPath := filepath.Join(parentPath, "nesting")
if err := os.Mkdir(parentPath, fs.ModePerm); !assert.NoError(t, err) { if err := os.Mkdir(parentPath, fs.ModePerm); !assert.NoError(t, err) {