From 95cb01e0a9517f7119e3d848728500692a4f5cba Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Wed, 20 Jun 2018 15:31:12 -0700 Subject: [PATCH] Reduce test sleep time PiperOrigin-RevId: 201428433 Change-Id: I72de1e46788ec84f61513416bb690956e515907e --- runsc/container/container_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go index 1116ca170..5128f5946 100644 --- a/runsc/container/container_test.go +++ b/runsc/container/container_test.go @@ -205,7 +205,9 @@ func TestLifecycle(t *testing.T) { // Wait on the container. var wg sync.WaitGroup wg.Add(1) + ch := make(chan struct{}) go func() { + ch <- struct{}{} ws, err := s.Wait() if err != nil { t.Fatalf("error waiting on container: %v", err) @@ -218,7 +220,8 @@ func TestLifecycle(t *testing.T) { // Wait a bit to ensure that we've started waiting on the container // before we signal. - time.Sleep(5 * time.Second) + <-ch + time.Sleep(100 * time.Millisecond) // 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)