Skip to content

Commit

Permalink
fix: make stop stopped container return no error
Browse files Browse the repository at this point in the history
Signed-off-by: Allen Sun <[email protected]>
  • Loading branch information
allencloud committed Apr 25, 2018
1 parent 0713c83 commit 9e5a042
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions daemon/mgr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,6 @@ func (mgr *ContainerManager) Stop(ctx context.Context, name string, timeout int6
c.Lock()
defer c.Unlock()

if !c.IsRunning() {
return fmt.Errorf("container's status is not running: %s", c.meta.State.Status)
}

if timeout == 0 {
timeout = c.StopTimeout()
}
Expand Down
3 changes: 3 additions & 0 deletions test/cli_stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func (suite *PouchStopSuite) TestStopWorks(c *check.C) {

command.PouchRun("start", name).Assert(c, icmd.Success)

// test stop a running container
command.PouchRun("stop", name).Assert(c, icmd.Success)
// test stop a stopped container
command.PouchRun("stop", name).Assert(c, icmd.Success)

res := command.PouchRun("ps", "-a")
Expand Down

0 comments on commit 9e5a042

Please sign in to comment.