-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtrfs_test.go
More file actions
42 lines (35 loc) · 848 Bytes
/
btrfs_test.go
File metadata and controls
42 lines (35 loc) · 848 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//go:build linux
package main
import (
"testing"
)
func TestIsBtrfs(t *testing.T) {
t.Run("nonexistent path returns false", func(t *testing.T) {
if isBtrfs("/nonexistent/path/that/does/not/exist") {
t.Error("nonexistent path should not be btrfs")
}
})
t.Run("proc is not btrfs", func(t *testing.T) {
if isBtrfs("/proc") {
t.Error("/proc should not be btrfs")
}
})
t.Run("sys is not btrfs", func(t *testing.T) {
if isBtrfs("/sys") {
t.Error("/sys should not be btrfs")
}
})
}
func TestRunScrubFailsWithoutBtrfs(t *testing.T) {
// /proc is never btrfs, so scrub should fail.
err := runScrub("/proc")
if err == nil {
t.Error("runScrub on /proc should fail")
}
}
func TestRunDefragFailsWithoutBtrfs(t *testing.T) {
err := runDefrag("/proc", 0)
if err == nil {
t.Error("runDefrag on /proc should fail")
}
}