35 lines
833 B
Go
35 lines
833 B
Go
//go:build !linux
|
|
|
|
package test
|
|
|
|
import (
|
|
"RenewCMS/internal/domain/update"
|
|
infraUpdate "RenewCMS/internal/infrastructure/update"
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestNoFollowFilesystemStubRefuses(t *testing.T) {
|
|
files := infraUpdate.NewNoFollowFilesystem()
|
|
|
|
_, lstatErr := files.Lstat("x")
|
|
_, readErr := files.ReadFile("x")
|
|
_, tempErr := files.MakePrivateTempDir()
|
|
|
|
for name, err := range map[string]error{
|
|
"lstat": lstatErr,
|
|
"read": readErr,
|
|
"tempdir": tempErr,
|
|
"create": files.CreateExclusive("x", nil, 0o600),
|
|
"copy": files.Copy("x", "y", 0o600),
|
|
"rename": files.Rename("x", "y"),
|
|
"remove": files.Remove("x"),
|
|
"removeAll": files.RemoveAll("x"),
|
|
"chmod": files.Chmod("x", 0o600),
|
|
} {
|
|
if !errors.Is(err, update.ErrHelperUnsupported) {
|
|
t.Errorf("%s = %v", name, err)
|
|
}
|
|
}
|
|
}
|