From d4e780d71f63c499aac4aaef18d496ba823b4256 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Thu, 20 Jul 2017 09:10:24 +0200 Subject: [PATCH] Ensure tasks are started when running tests This is needed on Windows since no process is actually running until `Start()` is called, meaning no other operation by `Delete()` would succeed. Signed-off-by: Kenfe-Mickael Laventure --- container_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/container_test.go b/container_test.go index 77429081e..d78650efe 100644 --- a/container_test.go +++ b/container_test.go @@ -273,6 +273,11 @@ func TestContainerExec(t *testing.T) { close(finished) }() + if err := task.Start(ctx); err != nil { + t.Error(err) + return + } + // start an exec process without running the original container process info processSpec := spec.Process withExecExitStatus(processSpec, 6) @@ -367,6 +372,11 @@ func TestContainerPids(t *testing.T) { statusC <- status }() + if err := task.Start(ctx); err != nil { + t.Error(err) + return + } + pid := task.Pid() if pid <= 0 { t.Errorf("invalid task pid %d", pid) @@ -847,6 +857,11 @@ func TestContainerExecNoBinaryExists(t *testing.T) { } defer task.Delete(ctx) + if err := task.Start(ctx); err != nil { + t.Error(err) + return + } + finished := make(chan struct{}, 1) go func() { if _, err := task.Wait(ctx); err != nil {