• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang tests.Run函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/codedellemc/libstorage/api/tests.Run函数的典型用法代码示例。如果您正苦于以下问题:Golang Run函数的具体用法?Golang Run怎么用?Golang Run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestVolumeAttach

func TestVolumeAttach(t *testing.T) {
	tf := func(config gofig.Config, client types.Client, t *testing.T) {

		nextDevice, err := client.Executor().NextDevice(
			context.Background().WithValue(context.ServiceKey, vfs.Name),
			utils.NewStore())
		assert.NoError(t, err)
		if err != nil {
			t.FailNow()
		}

		request := &types.VolumeAttachRequest{
			NextDeviceName: &nextDevice,
		}

		reply, attTokn, err := client.API().VolumeAttach(
			nil, vfs.Name, "vfs-002", request)
		assert.NoError(t, err)
		if reply == nil {
			t.FailNow()
		}
		assert.Equal(t, "/dev/xvdc", attTokn)
		assert.Equal(t, "vfs-002", reply.ID)
		assert.Equal(t, "/dev/xvdc", reply.Attachments[0].DeviceName)

	}
	apitests.Run(t, vfs.Name, newTestConfig(t), tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:28,代码来源:vfs_test.go


示例2: TestVolumeDetachAll

func TestVolumeDetachAll(t *testing.T) {
	tc, _, vols, _ := newTestConfigAll(t)
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		request := &types.VolumeDetachRequest{}
		reply, err := client.API().VolumeDetachAll(
			nil, request)
		assert.NoError(t, err)
		for _, v := range vols {
			v.Attachments = nil
		}
		assert.Equal(t, 1, len(reply))
		assert.Equal(t, 3, len(reply[vfs.Name]))
		assert.EqualValues(t, vols, reply[vfs.Name])

		reply, err = client.API().Volumes(nil, types.VolAttReqTrue)
		assert.NoError(t, err)
		assert.Equal(t, 1, len(reply))
		assert.Equal(t, 0, len(reply[vfs.Name]))

		reply, err = client.API().Volumes(nil, 0)
		assert.NoError(t, err)
		assert.Equal(t, 1, len(reply))
		assert.Equal(t, 3, len(reply[vfs.Name]))
	}
	apitests.Run(t, vfs.Name, tc, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:26,代码来源:vfs_test.go


示例3: TestSnapshotCopy

func TestSnapshotCopy(t *testing.T) {
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		snapshotName := "Snapshot from vfs-000-000"

		opts := map[string]interface{}{
			"priority": 2,
			"owner":    "[email protected]",
		}

		request := &types.SnapshotCopyRequest{
			SnapshotName: snapshotName,
			Opts:         opts,
		}

		reply, err := client.API().SnapshotCopy(
			nil, vfs.Name, "vfs-000-000", request)
		assert.NoError(t, err)
		apitests.LogAsJSON(reply, t)

		assert.Equal(t, snapshotName, reply.Name)
		assert.Equal(t, "vfs-000", reply.VolumeID)
		assert.Equal(t, "2", reply.Fields["priority"])
		assert.Equal(t, "[email protected]", reply.Fields["owner"])

	}
	apitests.Run(t, vfs.Name, newTestConfig(t), tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:27,代码来源:vfs_test.go


示例4: TestVolumeCopy

func TestVolumeCopy(t *testing.T) {
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		request := &types.VolumeCopyRequest{
			VolumeName: "Copy of Volume 000",
			Opts: map[string]interface{}{
				"priority": 7,
				"owner":    "[email protected]",
			},
		}

		reply, err := client.API().VolumeCopy(nil, vfs.Name, "vfs-000", request)
		assert.NoError(t, err)
		if err != nil {
			t.FailNow()
		}

		assert.NotNil(t, reply)

		assertVolDir(t, config, reply.ID, true)
		assert.Equal(t, "vfs-003", reply.ID)
		assert.Equal(t, request.VolumeName, reply.Name)
		assert.Equal(t, "7", reply.Fields["priority"])
		assert.Equal(t, request.Opts["owner"], reply.Fields["owner"])
	}

	apitests.Run(t, vfs.Name, newTestConfig(t), tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:27,代码来源:vfs_test.go


示例5: TestConfig

///////////////////////////////////////////////////////////////////////
/////////                    PUBLIC TESTS                     /////////
///////////////////////////////////////////////////////////////////////
// Test if backwards compatibility for "ec2" and "ebs" work in config
func TestConfig(t *testing.T) {
	if skipTests() {
		t.SkipNow()
	}
	tfEBS := func(config gofig.Config, client types.Client, t *testing.T) {
		assert.NotEqual(t, config.GetString("ebs.tag"), "")
		assert.Equal(t, config.GetString("ec2.tag"), "")
	}
	tfEC2 := func(config gofig.Config, client types.Client, t *testing.T) {
		assert.NotEqual(t, config.GetString("ec2.tag"), "")
		assert.Equal(t, config.GetString("ebs.tag"), "")
	}
	apitests.Run(t, "ec2", configYAMLebs, tfEBS)
	apitests.Run(t, "ec2", configYAMLec2, tfEC2)
	apitests.Run(t, ebs.Name, configYAMLebs, tfEBS)
	apitests.Run(t, ebs.Name, configYAMLec2, tfEC2)
}
开发者ID:emccode,项目名称:libstorage,代码行数:21,代码来源:ebs_test.go


示例6: TestVolumeCreateRemove

func TestVolumeCreateRemove(t *testing.T) { //PASSES lowercase hidden for testing other stuff
	if skipTests() {
		t.SkipNow()
	}
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		vol := volumeCreate(t, client, volumeName)
		volumeRemove(t, client, vol.ID)
	}
	apitests.Run(t, rackspace.Name, configYAML, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:10,代码来源:rackspace_test.go


示例7: TestServiceInpspect

func TestServiceInpspect(t *testing.T) {
	tf := func(config gofig.Config, client types.Client, t *testing.T) {

		reply, err := client.API().ServiceInspect(nil, vfs.Name)
		assert.NoError(t, err)
		assert.Equal(t, vfs.Name, reply.Name)
		assert.Equal(t, vfs.Name, reply.Driver.Name)
		assert.True(t, reply.Driver.NextDevice.Ignore)
	}
	apitests.Run(t, vfs.Name, newTestConfig(t), tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:11,代码来源:vfs_test.go


示例8: TestClient

func TestClient(t *testing.T) {
	apitests.Run(t, vfs.Name, newTestConfig(t),
		func(config gofig.Config, client types.Client, t *testing.T) {
			ctx := context.Background()
			iid, err := client.Executor().InstanceID(
				ctx.WithValue(context.ServiceKey, vfs.Name),
				utils.NewStore())
			assert.NoError(t, err)
			assert.NotNil(t, iid)
		})
}
开发者ID:emccode,项目名称:libstorage,代码行数:11,代码来源:vfs_test.go


示例9: TestVolumeCreateRemove

func TestVolumeCreateRemove(t *testing.T) {
	if skipTests() {
		t.SkipNow()
	}

	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		vol := volumeCreate(t, client, volumeName)
		volumeRemove(t, client, vol.ID)
	}
	apitests.Run(t, sio.Name, configYAML, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:11,代码来源:scaleio_test.go


示例10: TestEncryptedVolumeCreateRemove

// Test volume functionality from storage driver
func TestEncryptedVolumeCreateRemove(t *testing.T) {
	if skipTests() {
		t.SkipNow()
	}

	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		vol := volumeCreateEncrypted(t, client, volumeName, config.GetString("ec2.tag"))
		volumeRemove(t, client, vol.ID)
	}
	//apitests.Run(t, ebs.Name, configYAMLec2, tf)
	apitests.Run(t, "ebs", configYAMLec2, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:13,代码来源:ebs_test.go


示例11: TestInstanceID

func TestInstanceID(t *testing.T) {
	iid, err := instanceID()
	assert.NoError(t, err)
	if err != nil {
		t.FailNow()
	}
	apitests.Run(
		t, vfs.Name, newTestConfig(t),
		(&apitests.InstanceIDTest{
			Driver:   vfs.Name,
			Expected: iid,
		}).Test)
}
开发者ID:emccode,项目名称:libstorage,代码行数:13,代码来源:vfs_test.go


示例12: TestVolumeInspectWithAttachments

func TestVolumeInspectWithAttachments(t *testing.T) {
	tc, _, vols, _ := newTestConfigAll(t)
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().VolumeInspect(
			nil, "vfs", "vfs-000", types.VolAttReqTrue)
		if err != nil {
			t.Fatal(err)
		}
		assert.NotNil(t, reply)
		assert.EqualValues(t, vols[reply.ID], reply)
	}
	apitests.Run(t, vfs.Name, tc, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:13,代码来源:vfs_test.go


示例13: TestStorageDriverVolumes

func TestStorageDriverVolumes(t *testing.T) {
	apitests.Run(t, vfs.Name, newTestConfig(t),
		func(config gofig.Config, client types.Client, t *testing.T) {

			vols, err := client.Storage().Volumes(
				context.Background().WithValue(
					context.ServiceKey, vfs.Name),
				&types.VolumesOpts{
					Attachments: types.VolAttReqTrue,
					Opts:        utils.NewStore()})
			assert.NoError(t, err)
			assert.Len(t, vols, 2)
		})
}
开发者ID:emccode,项目名称:libstorage,代码行数:14,代码来源:vfs_test.go


示例14: TestSnapshotsByService

func TestSnapshotsByService(t *testing.T) {
	tc, _, _, snaps := newTestConfigAll(t)
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().SnapshotsByService(nil, "vfs")
		if err != nil {
			t.Fatal(err)
		}
		for snapshotID, snapshot := range snaps {
			assert.NotNil(t, reply[snapshotID])
			assert.EqualValues(t, snapshot, reply[snapshotID])
		}
	}
	apitests.Run(t, vfs.Name, tc, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:14,代码来源:vfs_test.go


示例15: TestServices

func TestServices(t *testing.T) { //PASSES lowercase hidden for testing other stuff
	if skipTests() {
		t.SkipNow()
	}

	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().Services(nil)
		assert.NoError(t, err)
		assert.Equal(t, len(reply), 1)

		_, ok := reply[rackspace.Name]
		assert.True(t, ok)
	}
	apitests.Run(t, rackspace.Name, configYAML, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:15,代码来源:rackspace_test.go


示例16: TestVolumeAttach

// TestVolumeAttach TODO how many times did I instruct people to use RunGroup
// for situations exactly like this? Fix it.
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)
		_ = volumeDetach(t, client, vol.ID)
		_ = volumeInspectDetached(t, client, vol.ID)
		volumeRemove(t, client, vol.ID)
	}
	apitests.Run(t, isilon.Name, configYAML, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:17,代码来源:isilon_test.go


示例17: TestVolumesByService

func TestVolumesByService(t *testing.T) {
	tc, _, vols, _ := newTestConfigAll(t)
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().VolumesByService(nil, "vfs", 0)
		if err != nil {
			t.Fatal(err)
		}
		for volumeID, volume := range vols {
			volume.Attachments = nil
			assert.NotNil(t, reply[volumeID])
			assert.EqualValues(t, volume, reply[volumeID])
		}
	}
	apitests.Run(t, vfs.Name, tc, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:15,代码来源:vfs_test.go


示例18: TestServices

// Test if Services are configured and returned properly from the client
func TestServices(t *testing.T) {
	if skipTests() {
		t.SkipNow()
	}

	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().Services(nil)
		assert.NoError(t, err)
		assert.Equal(t, len(reply), 1)

		_, ok := reply[ebs.Name]
		assert.True(t, ok)
	}
	tf2 := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().Services(nil)
		assert.NoError(t, err)
		assert.Equal(t, len(reply), 1)

		_, ok := reply["ec2"]
		assert.True(t, ok)
	}
	apitests.Run(t, ebs.Name, configYAMLec2, tf)
	apitests.Run(t, "ec2", configYAMLec2, tf2)
}
开发者ID:emccode,项目名称:libstorage,代码行数:25,代码来源:ebs_test.go


示例19: TestVolumesWithAttachmentsUnattached

func TestVolumesWithAttachmentsUnattached(t *testing.T) {
	tc, _, _, _ := newTestConfigAll(t)
	tf := func(config gofig.Config, client types.Client, t *testing.T) {
		reply, err := client.API().Volumes(nil,
			types.VolAttReqOnlyUnattachedVols)
		if err != nil {
			t.Fatal(err)
		}

		assert.Nil(t, reply["vfs"]["vfs-000"])
		assert.Nil(t, reply["vfs"]["vfs-001"])
		assert.NotNil(t, reply["vfs"]["vfs-002"])
		assert.Len(t, reply["vfs"]["vfs-002"].Attachments, 0)
	}
	apitests.Run(t, vfs.Name, tc, tf)
}
开发者ID:emccode,项目名称:libstorage,代码行数:16,代码来源:vfs_test.go


示例20: TestInstance

func TestInstance(t *testing.T) {
	iid, err := instanceID()
	assert.NoError(t, err)
	if err != nil {
		t.FailNow()
	}
	apitests.Run(
		t, vfs.Name, nil,
		(&apitests.InstanceTest{
			Driver: vfs.Name,
			Expected: &types.Instance{
				InstanceID: iid,
				Name:       "vfsInstance",
			},
		}).Test)
}
开发者ID:emccode,项目名称:libstorage,代码行数:16,代码来源:vfs_test.go



注:本文中的github.com/codedellemc/libstorage/api/tests.Run函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang types.Client类代码示例发布时间:2022-05-23
下一篇:
Golang tests.LogAsJSON函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap