0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-03-25 02:32:57 -05:00

fix(test): fix storage flaky tests (#1474)

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu 2023-05-25 21:24:56 +03:00 committed by GitHub
parent 2b8479f7f2
commit 4970f8814d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View file

@ -1297,6 +1297,24 @@ func TestDedupeLinks(t *testing.T) {
So(err, ShouldBeNil)
})
Convey("test RunDedupeForDigest directly, trigger stat error on original blob", func() {
// rebuild with dedupe true
imgStore := local.NewImageStore(dir, false, storage.DefaultGCDelay,
true, true, log, metrics, nil, cacheDriver)
duplicateBlobs := []string{
path.Join(dir, "dedupe1", "blobs", "sha256", blobDigest1),
path.Join(dir, "dedupe1", "blobs", "sha256", blobDigest2),
}
// remove original blob so that it can not be statted
err := os.Remove(path.Join(dir, "dedupe1", "blobs", "sha256", blobDigest1))
So(err, ShouldBeNil)
err = imgStore.RunDedupeForDigest(godigest.Digest(blobDigest1), true, duplicateBlobs)
So(err, ShouldNotBeNil)
})
Convey("Intrerrupt rebuilding and restart, checking idempotency", func() {
for i := 0; i < 10; i++ {
taskScheduler, cancel := runAndGetScheduler()

View file

@ -2026,7 +2026,7 @@ func TestRebuildDedupeIndex(t *testing.T) {
imgStore.RunDedupeBlobs(time.Duration(0), taskScheduler)
// wait until rebuild finishes
time.Sleep(5 * time.Second)
time.Sleep(10 * time.Second)
cancel()
@ -2068,7 +2068,7 @@ func TestRebuildDedupeIndex(t *testing.T) {
imgStore.RunDedupeBlobs(time.Duration(0), taskScheduler)
// wait until rebuild finishes
time.Sleep(5 * time.Second)
time.Sleep(10 * time.Second)
cancel()
@ -2108,7 +2108,7 @@ func TestRebuildDedupeIndex(t *testing.T) {
imgStore.RunDedupeBlobs(time.Duration(0), taskScheduler)
// wait until rebuild finishes
time.Sleep(3 * time.Second)
time.Sleep(5 * time.Second)
})
Convey("Trigger Stat error while getting original blob", func() {
@ -2161,7 +2161,7 @@ func TestRebuildDedupeIndex(t *testing.T) {
imgStore.RunDedupeBlobs(time.Duration(0), taskScheduler)
// wait until rebuild finishes
time.Sleep(3 * time.Second)
time.Sleep(5 * time.Second)
})
Convey("Trigger GetNextDigestWithBlobPaths path not found err", func() {
@ -2180,7 +2180,7 @@ func TestRebuildDedupeIndex(t *testing.T) {
imgStore.RunDedupeBlobs(time.Duration(0), taskScheduler)
// wait until rebuild finishes
time.Sleep(3 * time.Second)
time.Sleep(5 * time.Second)
})
Convey("Rebuild from true to false", func() {