Exemple #1
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)
}
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)
	}
	server.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)
}
Exemple #3
0
func TestAll(t *testing.T) {
	output, err := exec.Command("umount", btrfsFile).Output()
	if err != nil {
		t.Logf("error on umount %s (not fatal): %s %v", btrfsFile, string(output), err)
	}
	if err := os.Remove(btrfsFile); err != nil {
		t.Logf("error on rm %s (not fatal): %v", btrfsFile, err)
	}
	if err := os.MkdirAll(testPath, 0755); err != nil {
		t.Fatalf("failed on mkdir -p %s: %v", testPath, err)
	}
	file, err := os.Create(btrfsFile)
	if err != nil {
		t.Fatalf("failed to setup btrfs file at %s: %v", btrfsFile, err)
	}
	if err := file.Truncate(GiB); err != nil {
		t.Fatalf("failed to truncate %s 1G  %v", btrfsFile, err)
	}
	output, err = exec.Command("mkfs", "-t", "btrfs", "-f", btrfsFile).Output()
	if err != nil {
		t.Fatalf("failed to format to btrfs: %s %v", string(output), err)
	}
	output, err = exec.Command("mount", btrfsFile, testPath).Output()
	if err != nil {
		t.Fatalf("failed to mount to btrfs: %s %v", string(output), err)
	}
	if _, err := volume.New(Name, volume.DriverParams{RootParam: testPath}); err != nil {
		t.Fatalf("failed to initialize Driver: %v", err)
	}
	volumeDriver, err := volume.Get(Name)
	if err != nil {
		t.Fatalf("failed to initialize VolumeDriver: %v", err)
	}
	ctx := test.NewContext(volumeDriver)
	ctx.Filesystem = "btrfs"
	test.Run(t, ctx)
}