本文整理汇总了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)
}
开发者ID:ningjh,项目名称:tsuru,代码行数:22,代码来源:platform_test.go
示例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)
}
开发者ID:ningjh,项目名称:tsuru,代码行数:22,代码来源:platform_test.go
示例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)
}
开发者ID:ningjh,项目名称:tsuru,代码行数:22,代码来源:platform_test.go
注:本文中的github.com/tsuru/tsuru/testing.ExtensibleFakeProvisioner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论