From 647ec33c3385449ced9942acef6b345a457142a2 Mon Sep 17 00:00:00 2001 From: James Hewitt Date: Tue, 17 Oct 2023 02:10:43 +0100 Subject: [PATCH 1/2] Bump minio version and test less storage classes This fixes some of the tests for minio. The walk tests needs a version of minio that contains https://github.com/minio/minio/pull/18099 The storage classes minio supports are a subset of the s3 classes. Signed-off-by: James Hewitt --- registry/storage/driver/s3-aws/s3_test.go | 5 ++++- tests/docker-compose-storage.yml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3_test.go b/registry/storage/driver/s3-aws/s3_test.go index 5851d665c..db55328b0 100644 --- a/registry/storage/driver/s3-aws/s3_test.go +++ b/registry/storage/driver/s3-aws/s3_test.go @@ -210,7 +210,10 @@ func TestStorageClass(t *testing.T) { rootDir := t.TempDir() contents := []byte("contents") ctx := context.Background() - for _, storageClass := range s3StorageClasses { + + // We don't need to test all the storage classes, just that its selectable. + // The first 3 are common to AWS and MinIO, so use those. + for _, storageClass := range s3StorageClasses[:3] { filename := "/test-" + storageClass s3Driver, err := s3DriverConstructor(rootDir, storageClass) if err != nil { diff --git a/tests/docker-compose-storage.yml b/tests/docker-compose-storage.yml index 7377abcd7..19225eeeb 100644 --- a/tests/docker-compose-storage.yml +++ b/tests/docker-compose-storage.yml @@ -1,6 +1,6 @@ services: minio: - image: docker.io/minio/minio:RELEASE.2023-09-20T22-49-55Z + image: docker.io/minio/minio:RELEASE.2023-10-16T04-13-43Z command: server /data --console-address ":9001" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] @@ -17,7 +17,7 @@ services: - ./miniodata/distribution:/data:Z minio-init: - image: docker.io/minio/mc:RELEASE.2023-02-16T19-20-11Z + image: docker.io/minio/mc:RELEASE.2023-10-14T01-57-03Z depends_on: minio: condition: service_healthy From eac199875e122b68b7b360d761b191a4a8ef1c54 Mon Sep 17 00:00:00 2001 From: James Hewitt Date: Tue, 17 Oct 2023 09:13:15 +0100 Subject: [PATCH 2/2] Remove test for nested file delete on S3 Nested files aren't supported on MinIO, and as our storage layout is filesystem based, we don't actually use nest files in the code. Remove the test so that we can support MinIO. Signed-off-by: James Hewitt --- registry/storage/driver/s3-aws/s3_test.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3_test.go b/registry/storage/driver/s3-aws/s3_test.go index db55328b0..ebd9d2a2b 100644 --- a/registry/storage/driver/s3-aws/s3_test.go +++ b/registry/storage/driver/s3-aws/s3_test.go @@ -310,7 +310,6 @@ func TestDelete(t *testing.T) { objs := []string{ "/file1", "/file1-2", - "/file1/2", "/folder1/file1", "/folder2/file1", "/folder3/file1", @@ -322,15 +321,6 @@ func TestDelete(t *testing.T) { } tcs := []testCase{ - { - // special case where a given path is a file and has subpaths - name: "delete file1", - delete: "/file1", - expected: []string{ - "/file1", - "/file1/2", - }, - }, { name: "delete folder1", delete: "/folder1", @@ -374,16 +364,8 @@ func TestDelete(t *testing.T) { }, } - // objects to skip auto-created test case - skipCase := map[string]bool{ - // special case where deleting "/file1" also deletes "/file1/2" is tested explicitly - "/file1": true, - } // create a test case for each file for _, p := range objs { - if skipCase[p] { - continue - } tcs = append(tcs, testCase{ name: fmt.Sprintf("delete path:'%s'", p), delete: p,