Skip to content

Commit

Permalink
Merge pull request #18277 from giuseppe/fix-race-test-rm-cgroup
Browse files Browse the repository at this point in the history
test: fix race when listing cgroups
  • Loading branch information
openshift-merge-robot authored Apr 20, 2023
2 parents e74a408 + 0364aef commit 85d383b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/e2e/pod_rm_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"errors"
"fmt"
"io/fs"
"os"
Expand Down Expand Up @@ -47,11 +48,13 @@ var _ = Describe("Podman pod rm", func() {
// Also check that we don't leak cgroups
err := filepath.WalkDir("/sys/fs/cgroup", func(path string, d fs.DirEntry, err error) error {
if err != nil {
// A cgroup directory could have been deleted in the meanwhile filepath.WalkDir was
// accessing it. If that happens, we just ignore the error.
if d.IsDir() && errors.Is(err, os.ErrNotExist) {
return nil
}
return err
}
if !d.IsDir() {
Expect(err).ToNot(HaveOccurred())
}
if strings.Contains(d.Name(), podid) {
return fmt.Errorf("leaking cgroup path %s", path)
}
Expand Down

0 comments on commit 85d383b

Please sign in to comment.