From 66ed73f89f532c093dd42d84e8c004421e6d2962 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 28 Nov 2017 16:53:46 -0500 Subject: First pass at fixing test errors Signed-off-by: Matthew Heon Closes: #68 Approved by: rhatdan --- libpod/container.go | 8 +++----- libpod/runtime_ctr.go | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'libpod') diff --git a/libpod/container.go b/libpod/container.go index 8a2ff1fad..913d989ca 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -141,7 +141,7 @@ func (t ContainerState) String() string { case ContainerStatePaused: return "paused" } - return "" + return "bad state" } // ID returns the container's ID @@ -566,10 +566,8 @@ func (c *Container) Kill(signal uint) error { return err } - if c.state.State == ContainerStateUnknown || - c.state.State == ContainerStateConfigured || - c.state.State == ContainerStatePaused { - return errors.Wrapf(ErrCtrStateInvalid, "can only kill created, running, or stopped containers") + if c.state.State != ContainerStateRunning { + return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers") } return c.runtime.ociRuntime.killContainer(c, signal) diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 9a91e0a48..cf669eeb4 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -106,7 +106,7 @@ func (r *Runtime) RemoveContainer(c *Container, force bool) error { } else if !(c.state.State == ContainerStateConfigured || c.state.State == ContainerStateCreated || c.state.State == ContainerStateStopped) { - return errors.Wrapf(ErrCtrStateInvalid, "cannot remove container %s as it is running or paused", c.ID()) + return errors.Wrapf(ErrCtrStateInvalid, "cannot remove container %s as it is %s - running or paused containers cannot be removed", c.ID(), c.state.State.String()) } // Stop the container's storage -- cgit v1.2.3-54-g00ecf