本文整理汇总了Golang中github.com/tsuru/tsuru/provision/docker/container.Container.Stop方法的典型用法代码示例。如果您正苦于以下问题:Golang Container.Stop方法的具体用法?Golang Container.Stop怎么用?Golang Container.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/provision/docker/container.Container
的用法示例。
在下文中一共展示了Container.Stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestFollowLogsAndCommitForwardWaitFailure
func (s *S) TestFollowLogsAndCommitForwardWaitFailure(c *check.C) {
s.server.PrepareFailure("failed to wait for the container", "/containers/.*/wait")
defer s.server.ResetFailure("failed to wait for the container")
err := s.newFakeImage(s.p, "tsuru/python", nil)
c.Assert(err, check.IsNil)
app := provisiontest.NewFakeApp("myapp", "python", 1)
cont := container.Container{AppName: "mightyapp"}
err = cont.Create(&container.CreateArgs{
App: app,
ImageID: "tsuru/python",
Commands: []string{"foo"},
Provisioner: s.p,
})
c.Assert(err, check.IsNil)
err = cont.Start(&container.StartArgs{
Provisioner: s.p,
App: app,
})
c.Assert(err, check.IsNil)
err = cont.Stop(s.p)
c.Assert(err, check.IsNil)
buf := safe.NewBuffer(nil)
args := runContainerActionsArgs{writer: buf, provisioner: s.p}
context := action.FWContext{Params: []interface{}{args}, Previous: cont}
imageId, err := followLogsAndCommit.Forward(context)
c.Assert(err, check.ErrorMatches, `.*failed to wait for the container\n$`)
c.Assert(imageId, check.IsNil)
}