示例#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)
}
示例#2
0
func TestAll(t *testing.T) {
	if _, err := credentials.NewEnvCredentials().Get(); err != nil {
		t.Skip("No AWS credentials, skipping AWS driver test: ", err)
	}
	_, err := volume.New(Name, volume.DriverParams{})
	if err != nil {
		t.Logf("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.FSType_FS_TYPE_EXT4
	test.RunShort(t, ctx)
}
示例#3
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(Name, volume.DriverParams{"path": 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 = api.FSType_FS_TYPE_NFS

	test.RunShort(t, ctx)
}
示例#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)
	}
	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)
}
示例#5
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)
}