From dc5b77101d8f62271b0bab0e254a39b29dcb8373 Mon Sep 17 00:00:00 2001 From: Collin Shoop Date: Wed, 11 Aug 2021 14:44:43 -0400 Subject: [PATCH] storagedriver/s3: Cleaning up tests (cherry picked from commit 483ba26165ca66bcf18a1eaadf41ebe4d3bd5f85) Signed-off-by: Collin Shoop --- registry/storage/driver/s3-aws/s3_test.go | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3_test.go b/registry/storage/driver/s3-aws/s3_test.go index 2e9b55553..dc5510e2a 100644 --- a/registry/storage/driver/s3-aws/s3_test.go +++ b/registry/storage/driver/s3-aws/s3_test.go @@ -335,25 +335,6 @@ func TestDelete(t *testing.T) { t.Fatalf("unexpected error creating driver with standard storage: %v", err) } - var objs = []string{ - "/file1", - "/file1-2", - "/file1/2", - "/folder1/file1", - "/folder2/file1", - "/folder3/file1", - "/folder3/subfolder1/subfolder1/file1", - "/folder3/subfolder2/subfolder1/file1", - "/folder4/file1", - "/folder1-v2/file1", - "/folder1-v2/subfolder1/file1", - } - // objects to skip auto-created test case - var skipCase = map[string]bool{ - // special case where deleting "/file1" also deletes "/file1/2" is tested explicitly - "/file1": true, - } - type errFn func(error) bool type testCase struct { name string @@ -384,6 +365,20 @@ func TestDelete(t *testing.T) { return false } + var objs = []string{ + "/file1", + "/file1-2", + "/file1/2", + "/folder1/file1", + "/folder2/file1", + "/folder3/file1", + "/folder3/subfolder1/subfolder1/file1", + "/folder3/subfolder2/subfolder1/file1", + "/folder4/file1", + "/folder1-v2/file1", + "/folder1-v2/subfolder1/file1", + } + tcs := []testCase{ { // special case where a given path is a file and has subpaths @@ -437,7 +432,12 @@ func TestDelete(t *testing.T) { }, } - // init a test case for each file + // objects to skip auto-created test case + var 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 _, path := range objs { if skipCase[path] { continue @@ -536,7 +536,7 @@ func TestDelete(t *testing.T) { } if len(issues) > 0 { - t.Fatalf(strings.Join(issues, "; ")) + t.Fatalf(strings.Join(issues, "; \n\t")) } }) }