Browse code

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 <csnider@mirantis.com>

Cory Snider authored on 2022/11/05 03:07:54
Showing 1 changed files
... ...
@@ -1046,7 +1046,9 @@ func runParallelTests(t *testing.T, thrNumber int) {
1046 1046
 			<-thrdone
1047 1047
 		}
1048 1048
 
1049
-		testns.Close()
1049
+		if testns != origins {
1050
+			testns.Close()
1051
+		}
1050 1052
 		if err := net2.Delete(); err != nil {
1051 1053
 			t.Fatal(err)
1052 1054
 		}