1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

aufs: Skip tests if aufs not supported

This makes it possible to pass the rest of the testsuite without aufs in the kernel.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
Alexander Larsson 2014-02-18 11:58:38 +01:00
parent e8af7fcf6d
commit 9e28c3e3f8
2 changed files with 22 additions and 15 deletions

View file

@ -34,6 +34,10 @@ import (
"sync"
)
var (
ErrAufsNotSupported = fmt.Errorf("AUFS was not found in /proc/filesystems")
)
func init() {
graphdriver.Register("aufs", Init)
}
@ -100,7 +104,7 @@ func supportsAufs() error {
return nil
}
}
return fmt.Errorf("AUFS was not found in /proc/filesystems")
return ErrAufsNotSupported
}
func (a Driver) rootPath() string {

View file

@ -5,6 +5,7 @@ import (
"encoding/hex"
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/graphdriver"
"io/ioutil"
"os"
"path"
@ -15,15 +16,24 @@ var (
tmp = path.Join(os.TempDir(), "aufs-tests", "aufs")
)
func testInit(dir string, t *testing.T) graphdriver.Driver {
d, err := Init(dir)
if err != nil {
if err == ErrAufsNotSupported {
t.Skip(err)
} else {
t.Fatal(err)
}
}
return d
}
func newDriver(t *testing.T) *Driver {
if err := os.MkdirAll(tmp, 0755); err != nil {
t.Fatal(err)
}
d, err := Init(tmp)
if err != nil {
t.Fatal(err)
}
d := testInit(tmp, t)
return d.(*Driver)
}
@ -32,10 +42,7 @@ func TestNewDriver(t *testing.T) {
t.Fatal(err)
}
d, err := Init(tmp)
if err != nil {
t.Fatal(err)
}
d := testInit(tmp, t)
defer os.RemoveAll(tmp)
if d == nil {
t.Fatalf("Driver should not be nil")
@ -74,12 +81,8 @@ func TestNewDriverFromExistingDir(t *testing.T) {
t.Fatal(err)
}
if _, err := Init(tmp); err != nil {
t.Fatal(err)
}
if _, err := Init(tmp); err != nil {
t.Fatal(err)
}
testInit(tmp, t)
testInit(tmp, t)
os.RemoveAll(tmp)
}