mirror of
https://github.com/distribution/distribution.git
synced 2025-08-20 07:45:33 +00:00
storagedriver/s3: Cleaning up tests
This commit is contained in:
parent
e4af4dc3a6
commit
483ba26165
@ -306,25 +306,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
|
||||
@ -355,6 +336,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
|
||||
@ -408,7 +403,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
|
||||
@ -507,7 +507,7 @@ func TestDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(issues) > 0 {
|
||||
t.Fatalf(strings.Join(issues, "; "))
|
||||
t.Fatalf(strings.Join(issues, "; \n\t"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user