本文整理汇总了Golang中github.com/altoros/gosigma/mock.Endpoint函数的典型用法代码示例。如果您正苦于以下问题:Golang Endpoint函数的具体用法?Golang Endpoint怎么用?Golang Endpoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Endpoint函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetUpTest
func (s *instanceSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
cli, err := gosigma.NewClient(mock.Endpoint(""), mock.TestUser, mock.TestPassword, nil)
c.Assert(err, gc.IsNil)
mock.ResetServers()
ds, err := data.ReadServer(strings.NewReader(jsonInstanceData))
c.Assert(err, gc.IsNil)
mock.AddServer(ds)
mock.AddServer(&data.Server{
Resource: data.Resource{URI: "uri", UUID: "uuid-no-ip"},
})
server, err := cli.Server("f4ec5097-121e-44a7-a207-75bc02163260")
c.Assert(err, gc.IsNil)
c.Assert(server, gc.NotNil)
s.inst = &sigmaInstance{server}
server, err = cli.Server("uuid-no-ip")
c.Assert(err, gc.IsNil)
c.Assert(server, gc.NotNil)
s.instWithoutIP = &sigmaInstance{server}
}
开发者ID:Pankov404,项目名称:juju,代码行数:26,代码来源:instance_test.go
示例2: TestClientInstances
func (s *clientSuite) TestClientInstances(c *gc.C) {
addTestClientServer(c, "", "")
addTestClientServer(c, jujuMetaInstanceServer, "alien")
addTestClientServer(c, jujuMetaInstanceStateServer, "alien")
addTestClientServer(c, jujuMetaInstanceServer, "f54aac3a-9dcd-4a0c-86b5-24091478478c")
addTestClientServer(c, jujuMetaInstanceServer, "f54aac3a-9dcd-4a0c-86b5-24091478478c")
suuid := addTestClientServer(c, jujuMetaInstanceStateServer, "f54aac3a-9dcd-4a0c-86b5-24091478478c")
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
ss, err := cli.instances()
c.Assert(err, gc.IsNil)
c.Assert(ss, gc.NotNil)
c.Check(ss, gc.HasLen, 3)
sm, err := cli.instanceMap()
c.Assert(err, gc.IsNil)
c.Assert(sm, gc.NotNil)
c.Check(sm, gc.HasLen, 3)
ids, err := cli.getStateServerIds()
c.Check(err, gc.IsNil)
c.Check(len(ids), gc.Equals, 1)
c.Check(string(ids[0]), gc.Equals, suuid)
}
开发者ID:pmatulis,项目名称:juju,代码行数:26,代码来源:client_test.go
示例3: TestClientNewInstanceInvalidTemplate
func (s *clientSuite) TestClientNewInstanceInvalidTemplate(c *gc.C) {
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
params := environs.StartInstanceParams{
Constraints: constraints.Value{},
InstanceConfig: &instancecfg.InstanceConfig{
Bootstrap: true,
},
}
err = params.InstanceConfig.SetTools(tools.List{
&tools.Tools{
Version: version.Binary{
Series: "trusty",
},
URL: "https://0.1.2.3:2000/x.y.z.tgz",
},
})
c.Assert(err, jc.ErrorIsNil)
img := &imagemetadata.ImageMetadata{
Id: "invalid-id",
}
server, drive, arch, err := cli.newInstance(params, img, nil)
c.Check(server, gc.IsNil)
c.Check(arch, gc.Equals, "")
c.Check(drive, gc.IsNil)
c.Check(err, gc.ErrorMatches, "Failed to query drive template: 404 Not Found, notexist, notfound")
}
开发者ID:makyo,项目名称:juju,代码行数:28,代码来源:client_test.go
示例4: TestClientInvalidStopInstance
func (s *clientSuite) TestClientInvalidStopInstance(c *gc.C) {
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
var id instance.Id
err = cli.stopInstance(id)
c.Check(err, gc.ErrorMatches, "invalid instance id")
err = cli.stopInstance("1234")
c.Check(err, gc.ErrorMatches, "404 Not Found.*")
}
开发者ID:pmatulis,项目名称:juju,代码行数:11,代码来源:client_test.go
示例5: SetUpSuite
func (s *environInstanceSuite) SetUpSuite(c *gc.C) {
s.BaseSuite.SetUpSuite(c)
mock.Start()
attrs := testing.Attrs{
"name": "testname",
"uuid": "f54aac3a-9dcd-4a0c-86b5-24091478478c",
"region": mock.Endpoint(""),
"username": mock.TestUser,
"password": mock.TestPassword,
}
s.baseConfig = newConfig(c, validAttrs().Merge(attrs))
}
开发者ID:Pankov404,项目名称:juju,代码行数:14,代码来源:environinstance_test.go
示例6: SetUpSuite
func (s *environInstanceSuite) SetUpSuite(c *gc.C) {
s.BaseSuite.SetUpSuite(c)
mock.Start()
s.cloud = fakeCloudSpec()
s.cloud.Endpoint = mock.Endpoint("")
attrs := testing.Attrs{
"name": "testname",
"uuid": "f54aac3a-9dcd-4a0c-86b5-24091478478c",
}
s.baseConfig = newConfig(c, validAttrs().Merge(attrs))
}
开发者ID:bac,项目名称:juju,代码行数:14,代码来源:environinstance_test.go
示例7: TestClientNewInstance
func (s *clientSuite) TestClientNewInstance(c *gc.C) {
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
cli.conn.OperationTimeout(1 * time.Second)
params := environs.StartInstanceParams{
Constraints: constraints.Value{},
InstanceConfig: &instancecfg.InstanceConfig{
Bootstrap: true,
},
}
err = params.InstanceConfig.SetTools(tools.List{
&tools.Tools{
Version: version.Binary{
Series: "trusty",
},
URL: "https://0.1.2.3:2000/x.y.z.tgz",
},
})
c.Assert(err, jc.ErrorIsNil)
img := &imagemetadata.ImageMetadata{
Id: validImageId,
}
cs := newConstraints(params.InstanceConfig.Bootstrap, params.Constraints, img)
c.Assert(cs, gc.NotNil)
c.Check(err, gc.IsNil)
templateDrive := &data.Drive{
Resource: data.Resource{URI: "uri", UUID: cs.driveTemplate},
LibraryDrive: data.LibraryDrive{
Arch: "64",
ImageType: "image-type",
OS: "os",
Paid: true,
},
Size: 2200 * gosigma.Megabyte,
Status: "unmounted",
}
mock.ResetDrives()
mock.LibDrives.Add(templateDrive)
server, drive, arch, err := cli.newInstance(params, img, utils.Gzip([]byte{}))
c.Check(server, gc.NotNil)
c.Check(drive, gc.NotNil)
c.Check(arch, gc.NotNil)
c.Check(err, gc.IsNil)
}
开发者ID:makyo,项目名称:juju,代码行数:48,代码来源:client_test.go
示例8: TestClientNewInstanceInvalidParams
func (s *clientSuite) TestClientNewInstanceInvalidParams(c *gc.C) {
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
params := environs.StartInstanceParams{
Constraints: constraints.Value{},
}
img := &imagemetadata.ImageMetadata{
Id: validImageId,
}
server, drive, arch, err := cli.newInstance(params, img, nil)
c.Check(server, gc.IsNil)
c.Check(arch, gc.Equals, "")
c.Check(drive, gc.IsNil)
c.Check(err, gc.ErrorMatches, "invalid configuration for new instance: InstanceConfig is nil")
}
开发者ID:pmatulis,项目名称:juju,代码行数:16,代码来源:client_test.go
示例9: TestClientStopStateInstance
func (s *clientSuite) TestClientStopStateInstance(c *gc.C) {
addTestClientServer(c, "", "")
addTestClientServer(c, jujuMetaInstanceServer, "alien")
addTestClientServer(c, jujuMetaInstanceStateServer, "alien")
addTestClientServer(c, jujuMetaInstanceServer, "client-test")
suuid := addTestClientServer(c, jujuMetaInstanceStateServer, "client-test")
cli, err := testNewClient(c, mock.Endpoint(""), mock.TestUser, mock.TestPassword)
c.Assert(err, gc.IsNil)
err = cli.stopInstance(instance.Id(suuid))
c.Assert(err, gc.IsNil)
_, err = cli.getStateServerIds()
c.Check(err, gc.Equals, environs.ErrNotBootstrapped)
}
开发者ID:pmatulis,项目名称:juju,代码行数:17,代码来源:client_test.go
注:本文中的github.com/altoros/gosigma/mock.Endpoint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论