mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ef5bfad321
Since the layer store was introduced, the level above the graphdriver now differentiates between read/write and read-only layers. This distinction is useful for graphdrivers that need to take special steps when creating a layer based on whether it is read-only or not. Adding this parameter allows the graphdrivers to differentiate, which in the case of the Windows graphdriver, removes our dependence on parsing the id of the parent for "-init" in order to infer this information. This will also set the stage for unblocking some of the layer store unit tests in the next preview build of Windows. Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
63 lines
1.3 KiB
Go
63 lines
1.3 KiB
Go
// +build linux
|
|
|
|
package btrfs
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/daemon/graphdriver/graphtest"
|
|
)
|
|
|
|
// This avoids creating a new driver for each test if all tests are run
|
|
// Make sure to put new tests between TestBtrfsSetup and TestBtrfsTeardown
|
|
func TestBtrfsSetup(t *testing.T) {
|
|
graphtest.GetDriver(t, "btrfs")
|
|
}
|
|
|
|
func TestBtrfsCreateEmpty(t *testing.T) {
|
|
graphtest.DriverTestCreateEmpty(t, "btrfs")
|
|
}
|
|
|
|
func TestBtrfsCreateBase(t *testing.T) {
|
|
graphtest.DriverTestCreateBase(t, "btrfs")
|
|
}
|
|
|
|
func TestBtrfsCreateSnap(t *testing.T) {
|
|
graphtest.DriverTestCreateSnap(t, "btrfs")
|
|
}
|
|
|
|
func TestBtrfsSubvolDelete(t *testing.T) {
|
|
d := graphtest.GetDriver(t, "btrfs")
|
|
if err := d.CreateReadWrite("test", "", "", nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer graphtest.PutDriver(t)
|
|
|
|
dir, err := d.Get("test", "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer d.Put("test")
|
|
|
|
if err := subvolCreate(dir, "subvoltest"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if _, err := os.Stat(path.Join(dir, "subvoltest")); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err := d.Remove("test"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if _, err := os.Stat(path.Join(dir, "subvoltest")); !os.IsNotExist(err) {
|
|
t.Fatalf("expected not exist error on nested subvol, got: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestBtrfsTeardown(t *testing.T) {
|
|
graphtest.PutDriver(t)
|
|
}
|