etcd/pkg/btrfs/fs_test.go
Yicheng Qin bda8849c3b chore(btrfs): rename fs to btrfs
This is because the actions is specific for btrfs.
2014-04-09 15:06:17 -07:00

30 lines
524 B
Go

package btrfs
import (
"io/ioutil"
"os"
"os/exec"
"strings"
"testing"
)
func TestSetNOCOW(t *testing.T) {
name, err := ioutil.TempDir(".", "etcdtest")
if err != nil {
t.Fatal("Failed creating temp dir")
}
defer os.Remove(name)
if IsBtrfs(name) {
SetNOCOWDir(name)
cmd := exec.Command("lsattr", name)
out, err := cmd.Output()
if err != nil {
t.Fatal("Failed executing lsattr")
}
if !strings.Contains(string(out), "---------------C") {
t.Fatal("Failed setting NOCOW:\n", string(out))
}
}
}