Skip to content

Commit

Permalink
Merge pull request #1910 from jcanseco/portdeletion
Browse files Browse the repository at this point in the history
🐛 Fix issue with starting multiple test envs
  • Loading branch information
k8s-ci-robot committed May 24, 2022
2 parents c066edc + 81e2eb1 commit 4e6a39f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/internal/testing/addr/manager.go
Expand Up @@ -71,10 +71,20 @@ func (c *portCache) add(port int) (bool, error) {
}
info, err := d.Info()
if err != nil {
// No-op if file no longer exists; may have been deleted by another
// process/thread trying to allocate ports.
if errors.Is(err, fs.ErrNotExist) {
return nil
}
return err
}
if time.Since(info.ModTime()) > portReserveTime {
if err := os.Remove(filepath.Join(cacheDir, path)); err != nil {
// No-op if file no longer exists; may have been deleted by another
// process/thread trying to allocate ports.
if os.IsNotExist(err) {
return nil
}
return err
}
}
Expand Down

0 comments on commit 4e6a39f

Please sign in to comment.