From f39b83e232e398d1c89b0484752e46168e486a5d Mon Sep 17 00:00:00 2001 From: Cory Snider Date: Fri, 4 Nov 2022 14:07:54 -0400 Subject: [PATCH] libnetwork: fix TestParallel "bad file descriptor" When running inside a container, testns == origns. Consequently, closing testns causes the deferred netns.Set(origns) call to fail. Stop closing the aliased original namespace handle. Signed-off-by: Cory Snider --- libnetwork/libnetwork_linux_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnetwork/libnetwork_linux_test.go b/libnetwork/libnetwork_linux_test.go index de1e48a3cc..5be3ef2b53 100644 --- a/libnetwork/libnetwork_linux_test.go +++ b/libnetwork/libnetwork_linux_test.go @@ -1046,7 +1046,9 @@ func runParallelTests(t *testing.T, thrNumber int) { <-thrdone } - testns.Close() + if testns != origins { + testns.Close() + } if err := net2.Delete(); err != nil { t.Fatal(err) }