test(sync): retry RemoveAll on ENOTEMPTY in flaky extension test

Agent-Logs-Url: https://github.com/project-zot/zot/sessions/a8131207-64f5-4461-962a-19aab205da7d

Co-authored-by: rchincha <45800463+rchincha@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-19 01:50:08 +00:00
committed by GitHub
parent 4bc4261e84
commit 94d6a3e837
+12 -1
View File
@@ -17,6 +17,7 @@ import (
"reflect"
"strconv"
"strings"
"syscall"
goSync "sync"
"testing"
"time"
@@ -1550,7 +1551,17 @@ func TestDockerImagesAreSkipped(t *testing.T) {
// trigger config blob upstream error
// remove synced image
err = os.RemoveAll(path.Join(destDir, testImage))
downstreamImagePath := path.Join(destDir, testImage)
for retry := 0; retry < 5; retry++ {
err = os.RemoveAll(downstreamImagePath)
if err == nil || !errors.Is(err, syscall.ENOTEMPTY) {
break
}
time.Sleep(100 * time.Millisecond)
}
So(err, ShouldBeNil)
configBlobPath := path.Join(srcDir, testImage, "blobs/sha256", configBlobDigest.Encoded())