File: unmount_linux_test.go

package info (click to toggle)
golang-github-jacobsa-fuse 0.0~git20250829.cbc61fa-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 812 kB
  • sloc: makefile: 4
file content (27 lines) | stat: -rw-r--r-- 676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package fuse

import (
	"errors"
	"testing"
)

func Test_umountExpectCustomError(t *testing.T) {
	t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found

	err := unmount("/dev/fd/42")
	if err == nil || !errors.Is(err, ErrExternallyManagedMountPoint) {
		t.Errorf("Expected: %v, but got: %v", ErrExternallyManagedMountPoint, err)
	}
}

func Test_umountNoCustomError(t *testing.T) {
	t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found

	err := unmount("/dev")
	if err == nil {
		t.Fatal("Expected error but got none.")
	}
	if errors.Is(err, ErrExternallyManagedMountPoint) {
		t.Error("Custom error was not expected.")
	}
}