mirror of
https://github.com/rclone/rclone.git
synced 2024-12-21 11:06:55 +08:00
a365503750
This problem was caused by the defaults not being set for the options
after the conversion to the new config system in
28ba4b832d
serve nfs: convert options to new style
This makes the nfs serve options globally available so nfsmount can
use them directly.
Fixes #8029
37 lines
890 B
Go
37 lines
890 B
Go
//go:build unix
|
|
|
|
package nfsmount
|
|
|
|
import (
|
|
"os/exec"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/rclone/rclone/cmd/serve/nfs"
|
|
"github.com/rclone/rclone/vfs/vfscommon"
|
|
"github.com/rclone/rclone/vfs/vfstest"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// Return true if the command ran without error
|
|
func commandOK(name string, arg ...string) bool {
|
|
cmd := exec.Command(name, arg...)
|
|
_, err := cmd.CombinedOutput()
|
|
return err == nil
|
|
}
|
|
|
|
func TestMount(t *testing.T) {
|
|
if runtime.GOOS != "darwin" {
|
|
if !commandOK("sudo", "-n", "mount", "--help") {
|
|
t.Skip("Can't run sudo mount without a password")
|
|
}
|
|
if !commandOK("sudo", "-n", "umount", "--help") {
|
|
t.Skip("Can't run sudo umount without a password")
|
|
}
|
|
sudo = true
|
|
}
|
|
nfs.Opt.HandleCacheDir = t.TempDir()
|
|
require.NoError(t, nfs.Opt.HandleCache.Set("disk"))
|
|
vfstest.RunTests(t, false, vfscommon.CacheModeWrites, false, mount)
|
|
}
|