Merge pull request #5896 from kzys/pid-order
integration: fix TestContainerPids
This commit is contained in:
commit
a6034d021f
@ -443,9 +443,9 @@ func TestContainerPids(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pid := task.Pid()
|
taskPid := task.Pid()
|
||||||
if pid < 1 {
|
if taskPid < 1 {
|
||||||
t.Errorf("invalid task pid %d", pid)
|
t.Errorf("invalid task pid %d", taskPid)
|
||||||
}
|
}
|
||||||
processes, err := task.Pids(ctx)
|
processes, err := task.Pids(ctx)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
@ -459,12 +459,17 @@ func TestContainerPids(t *testing.T) {
|
|||||||
if l := len(processes); l != 2 {
|
if l := len(processes); l != 2 {
|
||||||
t.Errorf("expected 2 process but received %d", l)
|
t.Errorf("expected 2 process but received %d", l)
|
||||||
}
|
}
|
||||||
if len(processes) > 0 {
|
|
||||||
actual := processes[0].Pid
|
var found bool
|
||||||
if pid != actual {
|
for _, p := range processes {
|
||||||
t.Errorf("expected pid %d but received %d. processes = %+v", pid, actual, processes)
|
if p.Pid == taskPid {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !found {
|
||||||
|
t.Errorf("pid %d must be in %+v", taskPid, processes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
|
if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user