summaryrefslogtreecommitdiffhomepage
path: root/runsc/container/container_test.go
diff options
context:
space:
mode:
authorLantao Liu <lantaol@google.com>2018-07-02 14:51:20 -0700
committerShentubot <shentubot@google.com>2018-07-02 14:52:21 -0700
commit126296ce2adce615005ae16edb8b80e3bfae56cd (patch)
tree7851ede599ca90f9a09c601e7b5a76a340e5d098 /runsc/container/container_test.go
parentfa64c2a1517d20c08447bb2230f2903ec3baade9 (diff)
runsc: fix panic for `runsc wait` on stopped container.
PiperOrigin-RevId: 203016694 Change-Id: Ic51ef754aa6d7d1b3b35491aff96a63d7992e122
Diffstat (limited to 'runsc/container/container_test.go')
-rw-r--r--runsc/container/container_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go
index a6bb39c5d..d2f3cc14a 100644
--- a/runsc/container/container_test.go
+++ b/runsc/container/container_test.go
@@ -1211,6 +1211,9 @@ func TestMultiContainerWait(t *testing.T) {
} else if es := ws.ExitStatus(); es != 0 {
t.Errorf("process %q exited with non-zero status %d", strings.Join(containers[1].Spec.Process.Args, " "), es)
}
+ if _, err := containers[1].Wait(); err == nil {
+ t.Errorf("wait for stopped process %q should fail", strings.Join(containers[1].Spec.Process.Args, " "))
+ }
// After Wait returns, ensure that the root container is running and
// the child has finished.
@@ -1231,6 +1234,9 @@ func TestMultiContainerWait(t *testing.T) {
} else if es := ws.ExitStatus(); es != 0 {
t.Errorf("PID %d exited with non-zero status %d", pid, es)
}
+ if _, err := containers[0].WaitPID(pid); err == nil {
+ t.Errorf("wait for stopped PID %d should fail", pid)
+ }
}()
}