Exemplo n.º 1
0
func TestAll(t *testing.T) {

	/*
		cmd := exec.Command("dd", "if=/dev/zero", "of=/tmp/x", "bs=1M", "count=100")
		err := cmd.Run()
		if err != nil {
			t.Fatalf("Failed to create file: %v", err)
		}
		cmd = exec.Command("/sbin/mkfs.btrfs", "/tmp/x")
		err = cmd.Run()
		if err != nil {
			t.Fatalf("Failed to create btrfs:%v", err)
		}
		err = os.MkdirAll("/tmp/btrfs_test", 0755)
		if err != nil {
			t.Fatalf("Failed to create mkdir: %v", err)
		}
		err = syscall.Mount("/tmp/x", "/tmp/btrfs_test", "btrfs", syscall.MS_NODEV, "")
		if err != nil {
			t.Fatalf("Failed to mount btrfs: %v", err)
		}
	*/
	_, err := volume.New(Name, volume.DriverParams{RootParam: "/tmp/btrfs_test"})
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	d, err := volume.Get(Name)
	if err != nil {
		t.Fatalf("Failed to initialize Volume Driver: %v", err)
	}
	ctx := test.NewContext(d)
	ctx.Filesystem = api.FsBtrfs

	test.Run(t, ctx)
}
Exemplo n.º 2
0
func TestAll(t *testing.T) {
	_, err := volume.New(Name, volume.DriverParams{RootParam: testPath})
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	d, err := volume.Get(Name)
	if err != nil {
		t.Fatalf("Failed to initialize Volume Driver: %v", err)
	}
	ctx := test.NewContext(d)
	ctx.Filesystem = "btrfs"

	test.Run(t, ctx)
}
Exemplo n.º 3
0
func TestAll(t *testing.T) {

	_, err := volume.New(btrfs.Name, volume.DriverParams{btrfs.RootParam: "/tmp/btrfs_test"})
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	apiserver.StartDriverAPI(btrfs.Name, 9003, config.DriverAPIBase)
	time.Sleep(time.Second * 2)
	c, err := NewDriverClient(btrfs.Name)
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	d := c.VolumeDriver()
	ctx := test.NewContext(d)
	ctx.Filesystem = string(api.FsBtrfs)
	test.Run(t, ctx)
}
Exemplo n.º 4
0
func TestAll(t *testing.T) {
	err := os.MkdirAll(testPath, 0744)
	if err != nil {
		t.Fatalf("Failed to create test path: %v", err)
	}

	_, err = volume.New(nfs.Name, volume.DriverParams{"path": testPath})
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	apiserver.StartServerAPI(nfs.Name, 9003, config.DriverAPIBase)
	time.Sleep(time.Second * 2)
	c, err := NewDriverClient(nfs.Name)
	if err != nil {
		t.Fatalf("Failed to initialize Driver: %v", err)
	}
	d := c.VolumeDriver()
	ctx := test.NewContext(d)
	ctx.Filesystem = string("btrfs")
	test.Run(t, ctx)
}