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