本文整理汇总了Golang中github.com/tsuru/tsuru/testing.ExtensibleFakeProvisioner类的典型用法代码示例。如果您正苦于以下问题:Golang ExtensibleFakeProvisioner类的具体用法?Golang ExtensibleFakeProvisioner怎么用?Golang ExtensibleFakeProvisioner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensibleFakeProvisioner类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestPlatformAddWithProvisionerError
func (s *PlatformSuite) TestPlatformAddWithProvisionerError(c *gocheck.C) {
provisioner := testing.ExtensibleFakeProvisioner{
FakeProvisioner: testing.NewFakeProvisioner(),
}
provisioner.PrepareFailure("PlatformAdd", errors.New("build error"))
Provisioner = &provisioner
defer func() {
Provisioner = s.provisioner
}()
conn, err := db.Conn()
c.Assert(err, gocheck.IsNil)
defer conn.Close()
name := "test_platform_add"
args := make(map[string]string)
args["dockerfile"] = "http://localhost/Dockerfile"
err = PlatformAdd(name, args, nil)
defer conn.Platforms().Remove(bson.M{"_id": name})
c.Assert(err, gocheck.NotNil)
count, err := conn.Platforms().FindId(name).Count()
c.Assert(err, gocheck.IsNil)
c.Assert(count, gocheck.Equals, 0)
}
示例2: TestPlatformAdd
func (s *PlatformSuite) TestPlatformAdd(c *gocheck.C) {
provisioner := testing.ExtensibleFakeProvisioner{
FakeProvisioner: testing.NewFakeProvisioner(),
}
Provisioner = &provisioner
defer func() {
Provisioner = s.provisioner
}()
conn, err := db.Conn()
c.Assert(err, gocheck.IsNil)
defer conn.Close()
name := "test_platform_add"
args := make(map[string]string)
args["dockerfile"] = "http://localhost/Dockerfile"
err = PlatformAdd(name, args, nil)
defer conn.Platforms().Remove(bson.M{"_id": name})
c.Assert(err, gocheck.IsNil)
platform := provisioner.GetPlatform(name)
c.Assert(platform.Name, gocheck.Equals, name)
c.Assert(platform.Args, gocheck.DeepEquals, args)
c.Assert(platform.Version, gocheck.Equals, 1)
}
示例3: TestPlatformAddDuplicate
func (s *PlatformSuite) TestPlatformAddDuplicate(c *gocheck.C) {
provisioner := testing.ExtensibleFakeProvisioner{
FakeProvisioner: testing.NewFakeProvisioner(),
}
Provisioner = &provisioner
defer func() {
Provisioner = s.provisioner
}()
conn, err := db.Conn()
c.Assert(err, gocheck.IsNil)
defer conn.Close()
name := "test_platform_add"
args := make(map[string]string)
args["dockerfile"] = "http://localhost/Dockerfile"
err = PlatformAdd(name, args, nil)
defer conn.Platforms().Remove(bson.M{"_id": name})
c.Assert(err, gocheck.IsNil)
provisioner.PlatformRemove(name)
err = PlatformAdd(name, args, nil)
_, ok := err.(DuplicatePlatformError)
c.Assert(ok, gocheck.Equals, true)
}