mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #5042 from lifubang/backport-5014-fd-leaks-flake-1.3
[1.3] libct/int: TestFdLeaks: deflake
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user