From 501f43c16f1d3aa4b60e56c445a295af7925cd65 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Fri, 3 Jun 2022 14:46:16 -0700 Subject: [PATCH] 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 --- runsc/container/trace_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runsc/container/trace_test.go b/runsc/container/trace_test.go index 2a117f4c8..9a98af330 100644 --- a/runsc/container/trace_test.go +++ b/runsc/container/trace_test.go @@ -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) }