func TestNewDriverFromExistingDir(t *testing.T) {
	if err := os.MkdirAll(tmp, 0755); err != nil {
		t.Fatal(err)
	}
	testInit(tmp, t)
	testInit(tmp, t)
	os.RemoveAll(tmp)
}
We should be able to create two drivers with the same dir structure
package aufs
import (
	"crypto/sha256"
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"sync"
	"testing"
	graphdriver "github.com/containers/storage/drivers"
	"github.com/containers/storage/drivers/graphtest"
	"github.com/containers/storage/pkg/archive"
	"github.com/containers/storage/pkg/reexec"
	"github.com/containers/storage/pkg/stringid"
	"github.com/pkg/errors"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)
var (
	tmpOuter = path.Join(os.TempDir(), "aufs-tests")
	tmp      = path.Join(tmpOuter, "aufs")
)
func init() {
	reexec.Init()
}
func testInit(dir string, t testing.TB) graphdriver.Driver {
	d, err := Init(dir, graphdriver.Options{})
	if err != nil {
		if errors.Cause(err) == graphdriver.ErrNotSupported {
			t.Skip(err)
		} else {
			t.Fatal(err)
		}
	}
	return d
}
func driverGet(d *Driver, id string, mntLabel string) (string, error) {
	options := graphdriver.MountOpts{
		MountLabel: mntLabel,
	}
	return d.Get(id, options)
}
func newDriver(t testing.TB) *Driver {
	if err := os.MkdirAll(tmp, 0755); err != nil {
		t.Fatal(err)
	}
	d := testInit(tmp, t)
	return d.(*Driver)
}
func TestNewDriver(t *testing.T) {
	if err := os.MkdirAll(tmp, 0755); err != nil {
		t.Fatal(err)
	}
	d := testInit(tmp, t)
	defer os.RemoveAll(tmp)
	if d == nil {
		t.Fatal("Driver should not be nil")
	}
}
func TestAufsString(t *testing.T) {
	d := newDriver(t)
	defer os.RemoveAll(tmp)
	if d.String() != "aufs" {
		t.Fatalf("Expected aufs got %s", d.String())
	}
}
func TestCreateDirStructure(t *testing.T) {
	newDriver(t)
	defer os.RemoveAll(tmp)
	paths := []string{
		"mnt",
		"layers",
		"diff",
	}
	for _, p := range paths {
		if _, err := os.Stat(path.Join(tmp, p)); err != nil {
			t.Fatal(err)
		}
	}
}