mirror of
https://github.com/distribution/distribution.git
synced 2025-09-15 22:59:24 +00:00
Switch to github.com/google/uuid
Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
This commit is contained in:
@@ -7,16 +7,16 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/distribution/distribution/v3/internal/uuid"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func testUploadFS(t *testing.T, numUploads int, repoName string, startedAt time.Time) (driver.StorageDriver, context.Context) {
|
||||
d := inmemory.New()
|
||||
ctx := context.Background()
|
||||
for i := 0; i < numUploads; i++ {
|
||||
addUploads(ctx, t, d, uuid.Generate().String(), repoName, startedAt)
|
||||
addUploads(ctx, t, d, uuid.NewString(), repoName, startedAt)
|
||||
}
|
||||
return d, ctx
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func TestPurgeAll(t *testing.T) {
|
||||
fs, ctx := testUploadFS(t, uploadCount, "test-repo", oneHourAgo)
|
||||
|
||||
// Ensure > 1 repos are purged
|
||||
addUploads(ctx, t, fs, uuid.Generate().String(), "test-repo2", oneHourAgo)
|
||||
addUploads(ctx, t, fs, uuid.NewString(), "test-repo2", oneHourAgo)
|
||||
uploadCount++
|
||||
|
||||
deleted, errs := PurgeUploads(ctx, fs, time.Now(), true)
|
||||
@@ -92,7 +92,7 @@ func TestPurgeSome(t *testing.T) {
|
||||
newUploadCount := 4
|
||||
|
||||
for i := 0; i < newUploadCount; i++ {
|
||||
addUploads(ctx, t, fs, uuid.Generate().String(), "test-repo", time.Now().Add(1*time.Hour))
|
||||
addUploads(ctx, t, fs, uuid.NewString(), "test-repo", time.Now().Add(1*time.Hour))
|
||||
}
|
||||
|
||||
deleted, errs := PurgeUploads(ctx, fs, time.Now(), true)
|
||||
@@ -112,7 +112,7 @@ func TestPurgeOnlyUploads(t *testing.T) {
|
||||
|
||||
// Create a directory tree outside _uploads and ensure
|
||||
// these files aren't deleted.
|
||||
dataPath, err := pathFor(uploadDataPathSpec{name: "test-repo", id: uuid.Generate().String()})
|
||||
dataPath, err := pathFor(uploadDataPathSpec{name: "test-repo", id: uuid.NewString()})
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user