Deflake TestProcfsDump.

The sleep process in the container may have other open FDs to
SO files. So just check for stdout, stderr, stdin.

PiperOrigin-RevId: 452847291
This commit is contained in:
Ayush Ranjan
2022-06-03 14:49:11 -07:00
committed by gVisor bot
parent aaaa3429f7
commit 501f43c16f
+4 -4
View File
@@ -370,11 +370,11 @@ func TestProcfsDump(t *testing.T) {
t.Errorf("expected CWD %q, got %q", spec.Process.Cwd, procfsDump[0].CWD)
}
// Expect 3 host FDs for stdout, stdin and stderr.
if len(procfsDump[0].FDs) != 3 {
t.Errorf("expected 3 FDs for the sleep process, got %+v", procfsDump[0].FDs)
// Expect at least 3 host FDs for stdout, stdin and stderr.
if len(procfsDump[0].FDs) < 3 {
t.Errorf("expected at least 3 FDs for the sleep process, got %+v", procfsDump[0].FDs)
} else {
for i, fd := range procfsDump[0].FDs {
for i, fd := range procfsDump[0].FDs[:3] {
if want := int32(i); fd.Number != want {
t.Errorf("expected FD number %d, got %d", want, fd.Number)
}