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 <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-07-20 09:10:24 +02:00
parent 3df07cbc88
commit d4e780d71f
No known key found for this signature in database
GPG Key ID: 40CF16616B361216

View File

@ -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 {