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:
parent
3df07cbc88
commit
d4e780d71f
@ -273,6 +273,11 @@ func TestContainerExec(t *testing.T) {
|
|||||||
close(finished)
|
close(finished)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if err := task.Start(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// start an exec process without running the original container process info
|
// start an exec process without running the original container process info
|
||||||
processSpec := spec.Process
|
processSpec := spec.Process
|
||||||
withExecExitStatus(processSpec, 6)
|
withExecExitStatus(processSpec, 6)
|
||||||
@ -367,6 +372,11 @@ func TestContainerPids(t *testing.T) {
|
|||||||
statusC <- status
|
statusC <- status
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if err := task.Start(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pid := task.Pid()
|
pid := task.Pid()
|
||||||
if pid <= 0 {
|
if pid <= 0 {
|
||||||
t.Errorf("invalid task pid %d", pid)
|
t.Errorf("invalid task pid %d", pid)
|
||||||
@ -847,6 +857,11 @@ func TestContainerExecNoBinaryExists(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer task.Delete(ctx)
|
defer task.Delete(ctx)
|
||||||
|
|
||||||
|
if err := task.Start(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
finished := make(chan struct{}, 1)
|
finished := make(chan struct{}, 1)
|
||||||
go func() {
|
go func() {
|
||||||
if _, err := task.Wait(ctx); err != nil {
|
if _, err := task.Wait(ctx); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user