本文整理汇总了Golang中github.com/juju/cmd.ConnectionEndpoint函数的典型用法代码示例。如果您正苦于以下问题:Golang ConnectionEndpoint函数的具体用法?Golang ConnectionEndpoint怎么用?Golang ConnectionEndpoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConnectionEndpoint函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestAPIEndpointForEnvSuchName
func (s *ConnectionEndpointSuite) TestAPIEndpointForEnvSuchName(c *gc.C) {
cmd, err := initTestCommand(c, "-e", "no-such-env")
c.Assert(err, gc.IsNil)
_, err = cmd.ConnectionEndpoint(false)
c.Assert(err, jc.Satisfies, errors.IsNotFound)
c.Assert(err, gc.ErrorMatches, `environment "no-such-env" not found`)
}
示例2: TestAPIEndpointInStoreCached
func (s *ConnectionEndpointSuite) TestAPIEndpointInStoreCached(c *gc.C) {
cmd, err := initTestCommand(c, "-e", "env-name")
c.Assert(err, gc.IsNil)
endpoint, err := cmd.ConnectionEndpoint(false)
c.Assert(err, gc.IsNil)
c.Assert(endpoint, gc.DeepEquals, s.endpoint)
}
示例3: TestAPIEndpointRefresh
func (s *ConnectionEndpointSuite) TestAPIEndpointRefresh(c *gc.C) {
newEndpoint := configstore.APIEndpoint{
Addresses: []string{"foo.example.com"},
CACert: "certificated",
EnvironUUID: "fake-uuid",
}
s.PatchValue(envcmd.EndpointRefresher, func(_ *envcmd.EnvCommandBase) (io.Closer, error) {
info, err := s.store.ReadInfo("env-name")
info.SetAPIEndpoint(newEndpoint)
err = info.Write()
c.Assert(err, gc.IsNil)
return new(closer), nil
})
cmd, err := initTestCommand(c, "-e", "env-name")
c.Assert(err, gc.IsNil)
endpoint, err := cmd.ConnectionEndpoint(true)
c.Assert(err, gc.IsNil)
c.Assert(endpoint, gc.DeepEquals, newEndpoint)
}