mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 14:30:46 +02:00
fuse integration: skip when the host has no FUSE device node
Setup failed the test outright on machines without /dev/fuse instead of skipping; cover every suite entry point by skipping inside Setup.
This commit is contained in:
1 parent
af924a91d0
commit
5ac97e89cf
1 file changed
+16
@@ -185,6 +185,11 @@ func (f *FuseTestFramework) Setup(config *TestConfig) error {
|
||||
return fmt.Errorf("filer not ready: %v", err)
|
||||
}
|
||||
|
||||
// Skip rather than fail on a host with no FUSE device to mount through
|
||||
if !fuseAvailable() {
|
||||
f.t.Skip("no FUSE device node (/dev/fuse, /dev/macfuse0, /dev/osxfuse0)")
|
||||
}
|
||||
|
||||
// Mount FUSE filesystem
|
||||
if err := f.mountFuse(config); err != nil {
|
||||
return fmt.Errorf("failed to mount FUSE: %v", err)
|
||||
@@ -397,6 +402,17 @@ func (f *FuseTestFramework) waitForMount(timeout time.Duration) error {
|
||||
return fmt.Errorf("mount point not ready within timeout")
|
||||
}
|
||||
|
||||
// fuseAvailable reports whether the host has a FUSE device node to mount
|
||||
// through: /dev/fuse on Linux, /dev/macfuse* or /dev/osxfuse* on macOS.
|
||||
func fuseAvailable() bool {
|
||||
for _, dev := range []string{"/dev/fuse", "/dev/macfuse0", "/dev/osxfuse0"} {
|
||||
if _, err := os.Stat(dev); err == nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// findWeedBinary locates the weed binary. Candidates are resolved to
|
||||
// absolute paths because the started processes run with cmd.Dir set to the
|
||||
// framework's temp dir, where a relative path would not resolve.
|
||||
|
||||
Reference in new issue
Block a user