mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
test(sync): replace cleanup retry magic numbers with constants
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:
committed by
GitHub
parent
94d6a3e837
commit
873d4a3eeb
@@ -1551,15 +1551,20 @@ func TestDockerImagesAreSkipped(t *testing.T) {
|
||||
|
||||
// trigger config blob upstream error
|
||||
// remove synced image
|
||||
const (
|
||||
maxRemoveRetries = 5
|
||||
removeRetryDelay = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
downstreamImagePath := path.Join(destDir, testImage)
|
||||
|
||||
for retry := 0; retry < 5; retry++ {
|
||||
for retry := 0; retry < maxRemoveRetries; retry++ {
|
||||
err = os.RemoveAll(downstreamImagePath)
|
||||
if err == nil || !errors.Is(err, syscall.ENOTEMPTY) {
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(removeRetryDelay)
|
||||
}
|
||||
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
Reference in New Issue
Block a user