Skip to content

Commit 7d9ea48

Browse files
flaky: ignore errors about non existing files in validateFileTree (#8866)
* fix: ignore errors about non existing files in validateFileTree * Update testing/installtest/checks_unix.go Co-authored-by: Paolo Chilà <[email protected]> * Update testing/installtest/checks_unix.go Co-authored-by: Paolo Chilà <[email protected]> * fix: add errors import --------- Co-authored-by: Paolo Chilà <[email protected]>
1 parent b0822d9 commit 7d9ea48

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

testing/installtest/checks_unix.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package installtest
88

99
import (
1010
"context"
11+
"errors"
1112
"fmt"
1213
"io/fs"
1314
"math"
@@ -130,6 +131,9 @@ func checkPlatform(ctx context.Context, _ *atesting.Fixture, topPath string, opt
130131
func validateFileTree(dir string, uid uint32, gid uint32) error {
131132
return filepath.WalkDir(dir, func(file string, d fs.DirEntry, err error) error {
132133
if err != nil {
134+
if errors.Is(err, fs.ErrNotExist) {
135+
return nil
136+
}
133137
return fmt.Errorf("error traversing the file tree: %w", err)
134138
}
135139
if d.Type() == os.ModeSymlink {
@@ -138,6 +142,9 @@ func validateFileTree(dir string, uid uint32, gid uint32) error {
138142
}
139143
info, err := d.Info()
140144
if err != nil {
145+
if errors.Is(err, fs.ErrNotExist) {
146+
return nil
147+
}
141148
return fmt.Errorf("error caling info: %w", err)
142149
}
143150
fs, ok := info.Sys().(*syscall.Stat_t)

0 commit comments

Comments
 (0)