本文整理匯總了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)
}