Rework state tests to avoid boilerplate. Begin adding pod tests.

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

Closes: #268
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-01-29 04:59:25 -05:00
committed by Atomic Bot
parent 0920e8de5a
commit 4ecebf20b4
7 changed files with 759 additions and 385 deletions

View File

@ -121,8 +121,9 @@ func (r *Runtime) removeContainer(c *Container, force bool) error {
// We need to lock the pod before we lock the container
// To avoid races around removing a container and the pod it is in
var pod *Pod
var err error
if c.config.Pod != "" {
pod, err := r.state.Pod(c.config.Pod)
pod, err = r.state.Pod(c.config.Pod)
if err != nil {
return errors.Wrapf(err, "container %s is in pod %s, but pod cannot be retrieved", c.ID(), pod.ID())
}