summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2018-06-19 17:03:55 -0700
committerShentubot <shentubot@google.com>2018-06-19 17:04:51 -0700
commit33f29c730f46aacb56cb7710c31d19dbe0d5ff3f (patch)
tree8850beb09451866d6e5ad2f1380980850384a42f /runsc
parentbe76cad5bccd4091393e523b57960a4107101ca9 (diff)
runsc: Fix flakey container_test.
Verified that this is no longer flakey over 10K repetitions. PiperOrigin-RevId: 201267499 Change-Id: I793c916fe725412aec25953f764cb4f52c9fbed3
Diffstat (limited to 'runsc')
-rw-r--r--runsc/container/container_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go
index 7818990a7..7f87ea5ab 100644
--- a/runsc/container/container_test.go
+++ b/runsc/container/container_test.go
@@ -164,6 +164,7 @@ func TestLifecycle(t *testing.T) {
if _, err := container.Create(id, spec, conf, bundleDir, "", ""); err != nil {
t.Fatalf("error creating container: %v", err)
}
+
// Load the container from disk and check the status.
s, err := container.Load(rootDir, id)
if err != nil {
@@ -206,14 +207,17 @@ func TestLifecycle(t *testing.T) {
go func() {
ws, err := s.Wait()
if err != nil {
- t.Errorf("error waiting on container: %v", err)
+ t.Fatalf("error waiting on container: %v", err)
}
if got, want := ws.Signal(), syscall.SIGTERM; got != want {
- t.Errorf("got signal %v, want %v", got, want)
+ t.Fatalf("got signal %v, want %v", got, want)
}
wg.Done()
}()
+ // Wait a bit to ensure that we've started waiting on the container
+ // before we signal.
+ time.Sleep(5 * time.Second)
// Send the container a SIGTERM which will cause it to stop.
if err := s.Signal(syscall.SIGTERM); err != nil {
t.Fatalf("error sending signal %v to container: %v", syscall.SIGTERM, err)