本文整理匯總了Golang中github.com/juju/juju/tools/lxdclient.Config.UsingTCPRemote方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.UsingTCPRemote方法的具體用法?Golang Config.UsingTCPRemote怎麽用?Golang Config.UsingTCPRemote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/tools/lxdclient.Config
的用法示例。
在下文中一共展示了Config.UsingTCPRemote方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestUsingTCPRemote
func (s *configFunctionalSuite) TestUsingTCPRemote(c *gc.C) {
if s.client == nil {
c.Skip("LXD not running locally")
}
// We can't just pass the testingCert as part of the Local connection,
// because Validate() doesn't like Local remotes that have
// Certificates.
lxdclient.PatchGenerateCertificate(&s.CleanupSuite, testingCert, testingKey)
cfg := lxdclient.Config{
Namespace: "my-ns",
Remote: lxdclient.Local,
}
nonlocal, err := cfg.UsingTCPRemote()
c.Assert(err, jc.ErrorIsNil)
checkValidRemote(c, &nonlocal.Remote)
c.Check(nonlocal, jc.DeepEquals, lxdclient.Config{
Namespace: "my-ns",
Remote: lxdclient.Remote{
Name: lxdclient.Local.Name,
Host: nonlocal.Remote.Host,
Cert: nonlocal.Remote.Cert,
Protocol: lxdclient.LXDProtocol,
ServerPEMCert: nonlocal.Remote.ServerPEMCert,
},
})
c.Check(nonlocal.Remote.Host, gc.Not(gc.Equals), "")
c.Check(nonlocal.Remote.Cert.CertPEM, gc.Not(gc.Equals), "")
c.Check(nonlocal.Remote.Cert.KeyPEM, gc.Not(gc.Equals), "")
c.Check(nonlocal.Remote.ServerPEMCert, gc.Not(gc.Equals), "")
// TODO(ericsnow) Check that the server has the certs.
}
示例2: TestUsingTCPRemoteNoop
func (s *configSuite) TestUsingTCPRemoteNoop(c *gc.C) {
cfg := lxdclient.Config{
Namespace: "my-ns",
Remote: s.remote,
}
nonlocal, err := cfg.UsingTCPRemote()
c.Assert(err, jc.ErrorIsNil)
c.Check(nonlocal, jc.DeepEquals, cfg)
}