storagedriver/s3: Cleaning up tests
(cherry picked from commit 483ba26165ca66bcf18a1eaadf41ebe4d3bd5f85) Signed-off-by: Collin Shoop <cshoop@digitalocean.com>
This commit is contained in:
parent
6da7217b99
commit
dc5b77101d
1 changed files with 21 additions and 21 deletions
|
@ -335,25 +335,6 @@ func TestDelete(t *testing.T) {
|
||||||
t.Fatalf("unexpected error creating driver with standard storage: %v", err)
|
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 errFn func(error) bool
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
name string
|
name string
|
||||||
|
@ -384,6 +365,20 @@ func TestDelete(t *testing.T) {
|
||||||
return false
|
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{
|
tcs := []testCase{
|
||||||
{
|
{
|
||||||
// special case where a given path is a file and has subpaths
|
// 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 {
|
for _, path := range objs {
|
||||||
if skipCase[path] {
|
if skipCase[path] {
|
||||||
continue
|
continue
|
||||||
|
@ -536,7 +536,7 @@ func TestDelete(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(issues) > 0 {
|
if len(issues) > 0 {
|
||||||
t.Fatalf(strings.Join(issues, "; "))
|
t.Fatalf(strings.Join(issues, "; \n\t"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue