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