Exemple #1
0
func TestExecutorGet(t *testing.T) {
	apitests.RunGroup(
		t, vfs.Name, newTestConfig(t),
		apitests.TestGetExecutorLinux)
	//	apitests.TestGetExecutorDarwin)
	//apitests.TestGetExecutorWindows)
}
Exemple #2
0
func TestNextDevice(t *testing.T) {
	apitests.RunGroup(
		t, vfs.Name, newTestConfig(t),
		(&apitests.NextDeviceTest{
			Driver:   vfs.Name,
			Expected: "/dev/xvdc",
		}).Test)
}
Exemple #3
0
func TestVolumeAttach(t *testing.T) {
	if skipTests() {
		t.SkipNow()
	}
	var vol *types.Volume
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		vol = volumeCreate(t, client, volumeName)
		_ = volumeAttach(t, client, vol.ID)
		_ = volumeInspectAttached(t, client, vol.ID)
		// Don't test detaching volumes
		// _ = volumeDetach(t, client, vol.ID)
		// _ = volumeInspectDetached(t, client, vol.ID)
		volumeRemove(t, client, vol.ID)
	}
	apitests.RunGroup(t, efs.Name, configYAML, tf)
}
Exemple #4
0
func TestVolumeRemove(t *testing.T) {

	tf1 := func(config gofig.Config, client types.Client, t *testing.T) {
		assertVolDir(t, config, "vfs-002", true)
		err := client.API().VolumeRemove(nil, vfs.Name, "vfs-002")
		assert.NoError(t, err)
		assertVolDir(t, config, "vfs-002", false)
	}

	apitests.Run(t, vfs.Name, newTestConfig(t), tf1)

	tf2 := func(config gofig.Config, client types.Client, t *testing.T) {
		err := client.API().VolumeRemove(nil, vfs.Name, "vfs-002")
		assert.Error(t, err)
		httpErr := err.(goof.HTTPError)
		assert.Equal(t, "resource not found", httpErr.Error())
		assert.Equal(t, 404, httpErr.Status())
	}

	apitests.RunGroup(t, vfs.Name, newTestConfig(t), tf1, tf2)
}
Exemple #5
0
func TestLocalDevices(t *testing.T) {
	cfg, dfc, _, _ := newTestConfigAll(t)
	scn := bufio.NewScanner(bytes.NewBuffer(dfc))
	dfcMap := map[string]string{}
	for scn.Scan() {
		p := strings.SplitN(scn.Text(), "=", 2)
		k := p[0]
		v := ""
		if len(p) > 1 {
			v = p[1]
		}
		if len(v) > 0 {
			dfcMap[k] = v
		}
	}

	apitests.RunGroup(
		t, vfs.Name, cfg,
		(&apitests.LocalDevicesTest{
			Driver:   vfs.Name,
			Expected: &types.LocalDevices{Driver: vfs.Name, DeviceMap: dfcMap},
		}).Test)
}