Skip to content

Commit 4e6a39f

Browse files
authored
Merge pull request #1910 from jcanseco/portdeletion
🐛 Fix issue with starting multiple test envs
2 parents c066edc + 81e2eb1 commit 4e6a39f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/internal/testing/addr/manager.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,20 @@ func (c *portCache) add(port int) (bool, error) {
7171
}
7272
info, err := d.Info()
7373
if err != nil {
74+
// No-op if file no longer exists; may have been deleted by another
75+
// process/thread trying to allocate ports.
76+
if errors.Is(err, fs.ErrNotExist) {
77+
return nil
78+
}
7479
return err
7580
}
7681
if time.Since(info.ModTime()) > portReserveTime {
7782
if err := os.Remove(filepath.Join(cacheDir, path)); err != nil {
83+
// No-op if file no longer exists; may have been deleted by another
84+
// process/thread trying to allocate ports.
85+
if os.IsNotExist(err) {
86+
return nil
87+
}
7888
return err
7989
}
8090
}

0 commit comments

Comments
 (0)