本文整理汇总了Golang中github.com/tsuru/tsuru/provision.Register函数的典型用法代码示例。如果您正苦于以下问题:Golang Register函数的具体用法?Golang Register怎么用?Golang Register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Register函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
ProvisionerInstance = NewFakeProvisioner()
ExtensibleInstance = &ExtensibleFakeProvisioner{
FakeProvisioner: ProvisionerInstance,
}
provision.Register("fake", func() (provision.Provisioner, error) {
return ProvisionerInstance, nil
})
provision.Register("fake-extensible", func() (provision.Provisioner, error) {
return ExtensibleInstance, nil
})
}
示例2: TestShouldRegisterAllCommandsFromProvisioners
func (s *S) TestShouldRegisterAllCommandsFromProvisioners(c *check.C) {
fp := provisiontest.NewFakeProvisioner()
p := AdminCommandableProvisioner{FakeProvisioner: *fp}
provision.Register("fakeAdminProvisioner", &p)
manager := buildManager("tsuru-admin")
fake, ok := manager.Commands["fake-admin"]
c.Assert(ok, check.Equals, true)
c.Assert(fake, check.FitsTypeOf, &FakeAdminCommand{})
}
示例3: TestShouldRegisterAllCommandsFromProvisioners
func (s *S) TestShouldRegisterAllCommandsFromProvisioners(c *gocheck.C) {
fp := testing.NewFakeProvisioner()
p := CommandableProvisioner{FakeProvisioner: *fp}
provision.Register("comm", &p)
manager := buildManager()
fake, ok := manager.Commands["fake"]
c.Assert(ok, gocheck.Equals, true)
tsrFake, ok := fake.(*tsrCommand)
c.Assert(ok, gocheck.Equals, true)
c.Assert(tsrFake.Command, gocheck.FitsTypeOf, &FakeCommand{})
}
示例4: TestShouldRegisterAllCommandsFromProvisioners
func (s *S) TestShouldRegisterAllCommandsFromProvisioners(c *check.C) {
fp := provisiontest.NewFakeProvisioner()
p := CommandableProvisioner{FakeProvisioner: fp}
provision.Register("comm", func() (provision.Provisioner, error) { return &p, nil })
manager := buildManager()
fake, ok := manager.Commands["fake"]
c.Assert(ok, check.Equals, true)
tsurudFake, ok := fake.(*tsurudCommand)
c.Assert(ok, check.Equals, true)
c.Assert(tsurudFake.Command, check.FitsTypeOf, &FakeCommand{})
}
示例5: init
func init() {
mainDockerProvisioner = &dockerProvisioner{}
provision.Register("docker", mainDockerProvisioner)
}
示例6: init
func init() {
provision.Register("fake", &FakeProvisioner{})
}
示例7: init
func init() {
provision.Register("juju", &JujuProvisioner{})
}
示例8: init
func init() {
provision.Register(provisionerName, func() (provision.Provisioner, error) {
return &swarmProvisioner{}, nil
})
}
示例9: init
func init() {
provision.Register("docker", &dockerProvisioner{})
}