Do not run btrfs tests if btrfs kernel module is not loaded
Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
This commit is contained in:
parent
f0d2f89437
commit
b996e49c5c
@ -19,6 +19,7 @@
|
|||||||
package btrfs
|
package btrfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -44,7 +45,10 @@ func boltSnapshotter(t *testing.T) func(context.Context, string) (snapshots.Snap
|
|||||||
t.Skipf("could not find mkfs.btrfs: %v", err)
|
t.Skipf("could not find mkfs.btrfs: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check for btrfs in /proc/module and skip if not loaded
|
procModules, err := ioutil.ReadFile("/proc/modules")
|
||||||
|
if err == nil && !bytes.Contains(procModules, []byte("btrfs")) {
|
||||||
|
t.Skip("check for btrfs kernel module failed, skipping test")
|
||||||
|
}
|
||||||
|
|
||||||
return func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
|
return func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user