本文整理汇总了Golang中git/openstack/org/stackforge/golang-client/git/testUtil.IsNil函数的典型用法代码示例。如果您正苦于以下问题:Golang IsNil函数的具体用法?Golang IsNil怎么用?Golang IsNil使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsNil函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestServiceURLComputeV3Returns
func TestServiceURLComputeV3Returns(t *testing.T) {
sc := []service{createService("computev3", "nova", testEndpoints...)}
url, err := getComputeServiceURL("t", nil, sc, "compute", "region1", "3")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://endpoint1", url)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:7,代码来源:authServiceCatalogResolvingFunctions_test.go
示例2: TestCreateServer
func TestCreateServer(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, createServerJSONPayload, "servers",
`{"server":{"name":"my_server","imageRef":"8c3cd338-1282-4fbb-bbaf-2256ff97c7b7","key_name":"my_key_name","flavorRef":"101","maxcount":1,"mincount":1,"user_data":"my_user_data","availability_zone":"az1","networks":[{"uuid":"1111d337-0282-4fbb-bbaf-2256ff97c7b7","port":"881"}],"security_groups":[{"name":"my_security_group_123"}]}}`)
defer apiServer.Close()
serverService := CreateComputeService(apiServer.URL)
az := "az1"
userData := "my_user_data"
maxMinCount := int32(1)
var serverCreationParameters = ServerCreationParameters{
Name: "my_server",
ImageRef: "8c3cd338-1282-4fbb-bbaf-2256ff97c7b7",
KeyPairName: "my_key_name",
FlavorRef: "101",
MaxCount: &maxMinCount,
MinCount: &maxMinCount,
AvailabilityZone: &az,
UserData: &userData,
Networks: []ServerNetworkParameters{ServerNetworkParameters{UUID: "1111d337-0282-4fbb-bbaf-2256ff97c7b7", Port: "881"}},
SecurityGroups: []SecurityGroup{SecurityGroup{Name: "my_security_group_123"}}}
result, err := serverService.CreateServer(serverCreationParameters)
testUtil.IsNil(t, err)
testUtil.Equals(t, createServerResponse, result)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:26,代码来源:server_test.go
示例3: TestDelete
func TestDelete(t *testing.T) {
var apiServer = testUtil.CreateDeleteTestRequestServer(t, token, "/other")
defer apiServer.Close()
err := util.Delete(apiServer.URL+"/other", token, *http.DefaultClient)
testUtil.IsNil(t, err)
}
开发者ID:christoffetzer,项目名称:golang-client,代码行数:7,代码来源:util_test.go
示例4: TestServiceURLNetworkV3Returns
func TestServiceURLNetworkV3Returns(t *testing.T) {
sc := []service{createService("network", "neutron", testEndpoints...)}
url, err := getAppendVersionServiceURL("t", nil, sc, "network", "region2", "3")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://endpoint2/v3", url)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:7,代码来源:authServiceCatalogResolvingFunctions_test.go
示例5: TestFindEndpointVersionNoValueFoundNoErrorShouldOccur
func TestFindEndpointVersionNoValueFoundNoErrorShouldOccur(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, hpHelionImageVersionPayload, "")
defer apiServer.Close()
url, err := FindEndpointVersion(apiServer.URL, tokn, nil, "v2.0")
testUtil.IsNil(t, err)
testUtil.Equals(t, "", url)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:8,代码来源:serviceversionlist_test.go
示例6: TestDefaultServiceURLFoundInCatalogFoundInVersionList
func TestDefaultServiceURLFoundInCatalogFoundInVersionList(t *testing.T) {
apiServer := testVersionList(t)
defer apiServer.Close()
sc := []service{createService("image", "glance", endpoint{Region: "region1", PublicURL: apiServer.URL + "/publicurl", VersionList: apiServer.URL + "/versionlist"})}
url, err := defaultGetVersionURLFilterByVersion("t", nil, sc, "image", "region1", "1")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://region-b.geo-1.image.hpcloudsvc.com/v1/", url)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:8,代码来源:authServiceCatalogResolvingFunctions_test.go
示例7: TestFindEndpointVersionValid
func TestFindEndpointVersionValid(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, hpHelionImageVersionPayload, "")
defer apiServer.Close()
url, err := FindEndpointVersion(apiServer.URL, tokn, nil, "v1.0")
testUtil.IsNil(t, err)
testUtil.Equals(t, "http://region-a.geo-1.images.hpcloudsvc.com/v1/", url)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:8,代码来源:serviceversionlist_test.go
示例8: TestCreateUser
func TestCreateUser(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, "", "/instances/InstanceID/users",
`{"users":[{"name":"username","password":"32thbw3"}]}`)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.CreateUser("InstanceID", UserParameter{Name: "username", Password: "32thbw3"})
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:user_test.go
示例9: TestGetVolumeType
func TestGetVolumeType(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyStatusAndURL(t, tokn, 200, sampleVolumeTypeJson, "/types/id")
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
volume, err := service.VolumeType("id")
testUtil.IsNil(t, err)
testUtil.Equals(t, volumeTypeSample, volume)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:volumetype_test.go
示例10: TestDeleteVolumeType
func TestDeleteVolumeType(t *testing.T) {
name := "id"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "types/"+name)
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
err := service.DeleteVolumeType(name)
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:volumetype_test.go
示例11: TestDeleteUser
func TestDeleteUser(t *testing.T) {
name := "user"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "/instanceID/users/"+name)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.DeleteUser("instanceID", name)
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:user_test.go
示例12: TestCreateDatabase
func TestCreateDatabase(t *testing.T) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, "", "/instances/InstanceID/databases",
`{"databases":[{"character_set":"utf32","collate":"latin","name":"username"}]}`)
defer apiServer.Close()
service := CreateDatabaseService(apiServer.URL)
err := service.CreateDatabases("InstanceID", CreateDatabaseParameters{Name: "username", CharacterSet: "utf32", Collate: "latin"})
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:database_test.go
示例13: TestGetSecurityGroup
func TestGetSecurityGroup(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, sampleSecurityGroupJSONResponse, "/os-security-groups/w9236264")
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
sg, err := service.SecurityGroup("w9236264")
testUtil.IsNil(t, err)
testUtil.Equals(t, sampleSecurityGroup, sg)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:securitygroup_test.go
示例14: TestDeleteSecurityGroupRule
func TestDeleteSecurityGroupRule(t *testing.T) {
name := "securitygrouprule"
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "/os-security-group-rules/"+name)
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
err := service.DeleteSecurityGroupRule(name)
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:9,代码来源:securitygroup_test.go
示例15: TestGetVolumeTypes
func TestGetVolumeTypes(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyStatusAndURL(t, tokn, 200, sampleVolumeTypesJson, "/types")
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
volumes, err := service.VolumeTypes()
testUtil.IsNil(t, err)
testUtil.Assert(t, len(volumes) == 1, "Expected 1 volume")
testUtil.Equals(t, volumeTypeSample, volumes[0])
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:10,代码来源:volumetype_test.go
示例16: TestDeleteServer
func TestDeleteServer(t *testing.T) {
apiServer := testUtil.CreateDeleteTestRequestServer(t, tokn, "/servers/server")
defer apiServer.Close()
serverService := CreateComputeService(apiServer.URL)
err := serverService.DeleteServer("server")
testUtil.IsNil(t, err)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:10,代码来源:server_test.go
示例17: TestGetServerSecurityGroups
func TestGetServerSecurityGroups(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, sampleSecurityGroupsJSONResponse, "/os-security-groups/servers/aghagr")
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
sgs, err := service.ServerSecurityGroups("aghagr")
testUtil.IsNil(t, err)
testUtil.Equals(t, len(sgs), 1)
testUtil.Equals(t, sampleSecurityGroup, sgs[0])
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:10,代码来源:securitygroup_test.go
示例18: createVolumeTypeTest
func createVolumeTypeTest(t *testing.T, p blockstorage.CreateVolumeTypeParameters, expectedPayload string) {
apiServer := testUtil.CreatePostJSONTestRequestServer(t, tokn, sampleVolumeTypeJson, "types", expectedPayload)
defer apiServer.Close()
service := CreateVolumeService(apiServer.URL)
volume, err := service.CreateVolumeType(p)
testUtil.IsNil(t, err)
testUtil.Equals(t, volumeTypeSample, volume)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:10,代码来源:volumetype_test.go
示例19: TestServerDetailNoImage
func TestServerDetailNoImage(t *testing.T) {
apiServer := testUtil.CreateGetJSONTestRequestServerVerifyURL(t, tokn, serverDetailNoImagePayload, "/servers/my_server")
defer apiServer.Close()
service := CreateComputeService(apiServer.URL)
result, err := service.ServerDetail("my_server")
testUtil.IsNil(t, err)
testUtil.Equals(t, serverDetailNoImage, result)
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:11,代码来源:server_test.go
示例20: authenticate
func authenticate(t *testing.T) (string, common.Authenticator, common.AuthenticationParameters) {
ap := getAuthenticationParameters(t)
authenticator := identity.Authenticate(ap)
authenticator.SetFunction(requester.DebugRequestMakerGenerator(nil, nil, testing.Verbose()))
tokenID, err := authenticator.GetToken()
testUtil.IsNil(t, err)
testUtil.Assert(t, tokenID != "", "No tokenID was found.")
return tokenID, &authenticator, ap
}
开发者ID:alvaropeon,项目名称:hpcloud-kubesetup,代码行数:11,代码来源:auth_integration_test.go
注:本文中的git/openstack/org/stackforge/golang-client/git/testUtil.IsNil函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论