本文整理汇总了Golang中github.com/codedellemc/libstorage/api/tests.LogAsJSON函数的典型用法代码示例。如果您正苦于以下问题:Golang LogAsJSON函数的具体用法?Golang LogAsJSON怎么用?Golang LogAsJSON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogAsJSON函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: volumeAttach
// Test volume attachment by volume ID
func volumeAttach(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("attaching volume")
// Get next device name from executor
nextDevice, err := client.Executor().NextDevice(context.Background().WithValue(context.ServiceKey, ebs.Name),
utils.NewStore())
assert.NoError(t, err)
if err != nil {
t.Error("error getting next device name from executor")
t.FailNow()
}
reply, token, err := client.API().VolumeAttach(
nil, ebs.Name, volumeID, &types.VolumeAttachRequest{
NextDeviceName: &nextDevice,
})
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeAttach")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
assert.NotEqual(t, token, "")
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:28,代码来源:ebs_test.go
示例2: volumeCopy
func volumeCopy(
t *testing.T, client types.Client,
volumeID, volumeName string) *types.Volume {
fields := map[string]interface{}{
"volumeID": volumeID,
"volumeName": volumeName,
}
log.WithFields(fields).Info("copying volume")
volumeCopyRequest := &types.VolumeCopyRequest{
VolumeName: volumeName,
}
reply, err := client.API().VolumeCopy(nil,
rackspace.Name, volumeID, volumeCopyRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed volumeCopy")
}
apitests.LogAsJSON(reply, t)
assert.Equal(t, volumeName, reply.Name)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:26,代码来源:rackspace_test.go
示例3: volumeCreate
///////////////////////////////////////////////////////////////////////
///////// PRIVATE TESTS FOR VOLUME FUNCTIONALITY /////////
///////////////////////////////////////////////////////////////////////
// Test volume creation specifying size and volume name
func volumeCreate(
t *testing.T, client types.Client, volumeName, tag string) *types.Volume {
log.WithField("volumeName", volumeName).Info("creating volume")
// Prepare request for storage driver call to create volume
size := int64(1)
opts := map[string]interface{}{
"priority": 2,
"owner": "[email protected]",
}
volumeCreateRequest := &types.VolumeCreateRequest{
Name: volumeName,
Size: &size,
Opts: opts,
}
// Send request and retrieve created libStorage types.Volume
reply, err := client.API().VolumeCreate(nil, ebs.Name, volumeCreateRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed volumeCreate")
}
apitests.LogAsJSON(reply, t)
// If tag is set, then add tag to expected volumeName
if tag != "" {
volumeName = tag + ebs.TagDelimiter + volumeName
}
// Check if name and size are same
assert.Equal(t, volumeName, reply.Name)
assert.Equal(t, size, reply.Size)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:39,代码来源:ebs_test.go
示例4: volumeInspectDetachedFail
func volumeInspectDetachedFail(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("inspecting volume")
reply, err := client.API().VolumeInspect(nil, rackspace.Name, volumeID, 0)
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeInspectDetachedFail")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
assert.Len(t, reply.Attachments, 1)
apitests.LogAsJSON(reply, t)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:16,代码来源:rackspace_test.go
示例5: volumeSnapshot
func volumeSnapshot(
t *testing.T, client types.Client,
volumeID, snapshotName string) *types.Snapshot {
log.WithField("snapshotName", snapshotName).Info("creating snapshot")
/*
opts := map[string]interface{}{
"priority": 2,
"owner": "[email protected]",
}*/
volumeSnapshotRequest := &types.VolumeSnapshotRequest{
SnapshotName: snapshotName,
// Opts: opts,
}
reply, err := client.API().VolumeSnapshot(nil, rackspace.Name,
volumeID, volumeSnapshotRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed snapshotCreate")
}
apitests.LogAsJSON(reply, t)
assert.Equal(t, snapshotName, reply.Name)
assert.Equal(t, volumeID, reply.VolumeID)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:29,代码来源:rackspace_test.go
示例6: volumeCreate
func volumeCreate(
t *testing.T, client types.Client, volumeName string) *types.Volume {
log.WithField("volumeName", volumeName).Info("creating volume")
size := int64(8)
opts := map[string]interface{}{
"priority": 2,
"owner": "[email protected]",
}
volumeCreateRequest := &types.VolumeCreateRequest{
Name: volumeName,
Size: &size,
Opts: opts,
}
reply, err := client.API().VolumeCreate(nil, rackspace.Name, volumeCreateRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed volumeCreate")
}
apitests.LogAsJSON(reply, t)
assert.Equal(t, volumeName, reply.Name)
assert.Equal(t, int64(75), reply.Size)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:29,代码来源:rackspace_test.go
示例7: 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
示例8: volumeInspect
// Test volume retrieval by volume ID using VolumeInspect, which directly
// retrieves matching volumes from the storage driver. Contrast with
// volumeByID, which uses Volumes to retrieve all volumes from the storage
// driver without filtering, and filters the volumes externally.
func volumeInspect(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("inspecting volume")
reply, err := client.API().VolumeInspect(nil, ebs.Name, volumeID, 0)
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeInspect")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:17,代码来源:ebs_test.go
示例9: snapshotInspect
func snapshotInspect(
t *testing.T, client types.Client, snapshotID string) *types.Snapshot {
log.WithField("snapshotID", snapshotID).Info("inspecting snapshot")
reply, err := client.API().SnapshotInspect(nil, rackspace.Name, snapshotID)
assert.NoError(t, err)
if err != nil {
t.Error("failed snapshotInspect")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:13,代码来源:rackspace_test.go
示例10: volumeDetach
// Test detaching volume by volume ID
func volumeDetach(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("detaching volume")
reply, err := client.API().VolumeDetach(
nil, ebs.Name, volumeID, &types.VolumeDetachRequest{})
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeDetach")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
assert.Len(t, reply.Attachments, 0)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:15,代码来源:ebs_test.go
示例11: volumeAttach
func volumeAttach(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("attaching volume")
reply, token, err := client.API().VolumeAttach(
nil, rackspace.Name, volumeID, &types.VolumeAttachRequest{})
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeAttach")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
assert.NotEqual(t, token, "")
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:17,代码来源:rackspace_test.go
示例12: volumeInspectAttached
func volumeInspectAttached(
t *testing.T, client types.Client, volumeID string) *types.Volume {
log.WithField("volumeID", volumeID).Info("inspecting volume")
reply, err := client.API().VolumeInspect(
nil, isilon.Name, volumeID, types.VolAttReqTrue)
assert.NoError(t, err)
if err != nil {
t.Error("failed volumeInspectAttached")
t.FailNow()
}
apitests.LogAsJSON(reply, t)
assert.Len(t, reply.Attachments, 1)
// assert.NotEqual(t, "", reply.Attachments[0].DeviceName)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:17,代码来源:isilon_test.go
示例13: snapshotCopy
func snapshotCopy(
t *testing.T, client types.Client,
snapshotID, snapshotName, destinationID string) *types.Snapshot {
log.WithField("snapshotName", snapshotName).Info("copying snapshot")
snapshotCopyRequest := &types.SnapshotCopyRequest{
SnapshotName: snapshotName,
}
reply, err := client.API().SnapshotCopy(nil, rackspace.Name,
snapshotID, snapshotCopyRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed snapshotCopy")
}
apitests.LogAsJSON(reply, t)
assert.Equal(t, snapshotName, reply.Name)
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:21,代码来源:rackspace_test.go
示例14: volumeCreateFromSnapshot
func volumeCreateFromSnapshot(
t *testing.T, client types.Client,
snapshotID, volumeName string) *types.Volume {
fields := map[string]interface{}{
"snapshotID": snapshotID,
"volumeName": volumeName,
}
log.WithFields(fields).Info("creating volume from snapshot")
size := int64(8)
opts := map[string]interface{}{
"priority": 2,
"owner": "[email protected]",
}
volumeCreateRequest := &types.VolumeCreateRequest{
Name: volumeName,
Size: &size,
Opts: opts,
}
reply, err := client.API().VolumeCreateFromSnapshot(nil,
rackspace.Name, snapshotID, volumeCreateRequest)
assert.NoError(t, err)
if err != nil {
t.FailNow()
t.Error("failed volumeCreateFromSnapshot")
}
apitests.LogAsJSON(reply, t)
assert.Equal(t, volumeName, reply.Name)
assert.Equal(t, size, reply.Size)
assert.Equal(t, opts["priority"], 2)
assert.Equal(t, opts["owner"], "[email protected]")
return reply
}
开发者ID:emccode,项目名称:libstorage,代码行数:37,代码来源:rackspace_test.go
注:本文中的github.com/codedellemc/libstorage/api/tests.LogAsJSON函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论