diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index 228047767..df99da26b 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -9,6 +9,7 @@ import ( "os/exec" "path/filepath" "reflect" + "slices" "strconv" "strings" "syscall" @@ -1702,7 +1703,11 @@ func fdList(t *testing.T) []string { fds, err := fdDir.Readdirnames(-1) ok(t, err) - return fds + // Remove the fdDir fd. + extraFd := strconv.Itoa(int(fdDir.Fd())) + return slices.DeleteFunc(fds, func(fd string) bool { + return fd == extraFd + }) } func testFdLeaks(t *testing.T, systemd bool) { @@ -1724,7 +1729,7 @@ func testFdLeaks(t *testing.T, systemd bool) { _ = runContainerOk(t, config, "true") fds1 := fdList(t) - if reflect.DeepEqual(fds0, fds1) { + if slices.Equal(fds0, fds1) { return } // Show the extra opened files.