mirror of
https://github.com/distribution/distribution.git
synced 2025-08-21 08:13:39 +00:00
storagedriver/s3: Added Walk test case for dealing with errors
This commit is contained in:
parent
9a4da20cf1
commit
9618ba7231
@ -2,6 +2,7 @@ package s3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -268,6 +269,7 @@ func TestWalk(t *testing.T) {
|
|||||||
return isDir
|
return isDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create file structure matching fileset above
|
||||||
var created []string
|
var created []string
|
||||||
for _, paths := range fileset {
|
for _, paths := range fileset {
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
@ -351,6 +353,17 @@ func TestWalk(t *testing.T) {
|
|||||||
"/folder1/file1",
|
"/folder1/file1",
|
||||||
// stop early
|
// stop early
|
||||||
},
|
},
|
||||||
|
err: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "error",
|
||||||
|
fn: func(fileInfo storagedriver.FileInfo) error {
|
||||||
|
return errors.New("foo")
|
||||||
|
},
|
||||||
|
expected: []string{
|
||||||
|
"/",
|
||||||
|
},
|
||||||
|
err: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "from folder",
|
name: "from folder",
|
||||||
|
Loading…
Reference in New Issue
Block a user