First pass at fixing test errors

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
This commit is contained in:
Matthew Heon 2017-11-28 16:53:46 -05:00 committed by Atomic Bot
parent e36483b1e6
commit 66ed73f89f
2 changed files with 4 additions and 6 deletions

View File

@ -141,7 +141,7 @@ func (t ContainerState) String() string {
case ContainerStatePaused: case ContainerStatePaused:
return "paused" return "paused"
} }
return "" return "bad state"
} }
// ID returns the container's ID // ID returns the container's ID
@ -566,10 +566,8 @@ func (c *Container) Kill(signal uint) error {
return err return err
} }
if c.state.State == ContainerStateUnknown || if c.state.State != ContainerStateRunning {
c.state.State == ContainerStateConfigured || return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers")
c.state.State == ContainerStatePaused {
return errors.Wrapf(ErrCtrStateInvalid, "can only kill created, running, or stopped containers")
} }
return c.runtime.ociRuntime.killContainer(c, signal) return c.runtime.ociRuntime.killContainer(c, signal)

View File

@ -106,7 +106,7 @@ func (r *Runtime) RemoveContainer(c *Container, force bool) error {
} else if !(c.state.State == ContainerStateConfigured || } else if !(c.state.State == ContainerStateConfigured ||
c.state.State == ContainerStateCreated || c.state.State == ContainerStateCreated ||
c.state.State == ContainerStateStopped) { 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 // Stop the container's storage