Formatting issues fixed.

master
Karthic Rao 9 years ago
parent 7a97622fed
commit ff41c050d5
  1. 19
      pkg/fs/dir.go
  2. 264
      pkg/fs/fs-bucket-listobjects_test.go

@ -26,11 +26,11 @@ import (
) )
const ( const (
// ListObjectsLimit - maximum list objects limit. // listObjectsLimit - maximum list objects limit.
listObjectsLimit = 1000 listObjectsLimit = 1000
) )
// IsDirEmpty - returns whether given directory is empty or not. // isDirEmpty - returns whether given directory is empty or not.
func isDirEmpty(dirname string) (status bool, err error) { func isDirEmpty(dirname string) (status bool, err error) {
f, err := os.Open(dirname) f, err := os.Open(dirname)
if err == nil { if err == nil {
@ -44,7 +44,7 @@ func isDirEmpty(dirname string) (status bool, err error) {
return return
} }
// IsDirExist - returns whether given directory is exist or not. // isDirExist - returns whether given directory is exist or not.
func isDirExist(dirname string) (status bool, err error) { func isDirExist(dirname string) (status bool, err error) {
fi, err := os.Lstat(dirname) fi, err := os.Lstat(dirname)
if err == nil { if err == nil {
@ -54,7 +54,7 @@ func isDirExist(dirname string) (status bool, err error) {
return return
} }
// ByName implements sort.Interface for sorting os.FileInfo list. // byName implements sort.Interface for sorting os.FileInfo list.
type byName []os.FileInfo type byName []os.FileInfo
func (f byName) Len() int { func (f byName) Len() int {
@ -99,7 +99,7 @@ func searchFileInfos(fileInfos []os.FileInfo, x string) int {
return sort.Search(len(fileInfos), processFunc) return sort.Search(len(fileInfos), processFunc)
} }
// ReadDir - read 'scanDir' directory. It returns list of ObjectInfo. // readDir - read 'scanDir' directory. It returns list of ObjectInfo.
// Each object name is appended with 'namePrefix'. // Each object name is appended with 'namePrefix'.
func readDir(scanDir, namePrefix, queryPrefix string, isFirst bool) (objInfos []ObjectInfo) { func readDir(scanDir, namePrefix, queryPrefix string, isFirst bool) (objInfos []ObjectInfo) {
f, err := os.Open(scanDir) f, err := os.Open(scanDir)
@ -158,7 +158,7 @@ func readDir(scanDir, namePrefix, queryPrefix string, isFirst bool) (objInfos []
// For directories explicitly end with '/'. // For directories explicitly end with '/'.
if isDir { if isDir {
name += "/" name += "/"
// Size is set to '0' for directories explicitly. // size is set to '0' for directories explicitly.
size = 0 size = 0
} }
@ -175,7 +175,8 @@ func readDir(scanDir, namePrefix, queryPrefix string, isFirst bool) (objInfos []
// For directories explicitly end with '/'. // For directories explicitly end with '/'.
if isDir { if isDir {
name += "/" name += "/"
size = 0 // Size is set to '0' for directories explicitly. // size is set to '0' for directories explicitly.
size = 0
} }
} }
@ -258,7 +259,7 @@ func (oic ObjectInfoChannel) IsTimedOut() bool {
} }
} }
// TreeWalk - walk into 'scanDir' recursively when 'recursive' is true. // treeWalk - walk into 'scanDir' recursively when 'recursive' is true.
// It uses 'bucketDir' to get name prefix for object name. // It uses 'bucketDir' to get name prefix for object name.
func treeWalk(scanDir, bucketDir string, recursive bool, queryPrefix string) ObjectInfoChannel { func treeWalk(scanDir, bucketDir string, recursive bool, queryPrefix string) ObjectInfoChannel {
objectInfoCh := make(chan ObjectInfo, listObjectsLimit) objectInfoCh := make(chan ObjectInfo, listObjectsLimit)
@ -269,7 +270,7 @@ func treeWalk(scanDir, bucketDir string, recursive bool, queryPrefix string) Obj
defer close(objectInfoCh) defer close(objectInfoCh)
defer close(timeoutCh) defer close(timeoutCh)
// Send function - returns true if ObjectInfo is sent. // send function - returns true if ObjectInfo is sent.
// Within (time.Second * 15) else false on time-out. // Within (time.Second * 15) else false on time-out.
send := func(oi ObjectInfo) bool { send := func(oi ObjectInfo) bool {
timer := time.After(time.Second * 15) timer := time.After(time.Second * 15)

@ -100,324 +100,324 @@ func TestListObjects(t *testing.T) {
resultCases := []ListObjectsResult{ resultCases := []ListObjectsResult{
// ListObjectsResult-0. // ListObjectsResult-0.
// Testing for listing all objects in the bucket, (testCase 20,21,22). // Testing for listing all objects in the bucket, (testCase 20,21,22).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-1. // ListObjectsResult-1.
// Used for asserting the truncated case, (testCase 23). // Used for asserting the truncated case, (testCase 23).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
}, },
}, },
// ListObjectsResult-2. // ListObjectsResult-2.
// (TestCase 24). // (TestCase 24).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
}, },
}, },
// ListObjectsResult-3. // ListObjectsResult-3.
// (TestCase 25). // (TestCase 25).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
}, },
}, },
// ListObjectsResult-4. // ListObjectsResult-4.
// Again used for truncated case. // Again used for truncated case.
// (TestCase 26). // (TestCase 26).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
}, },
}, },
// ListObjectsResult-5. // ListObjectsResult-5.
// Used for Asserting prefixes. // Used for Asserting prefixes.
// Used for test case with prefix "new", (testCase 27-29). // Used for test case with prefix "new", (testCase 27-29).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
}, },
}, },
// ListObjectsResult-6. // ListObjectsResult-6.
// Used for Asserting prefixes. // Used for Asserting prefixes.
// Used for test case with prefix = "obj", (testCase 30). // Used for test case with prefix = "obj", (testCase 30).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-7. // ListObjectsResult-7.
// Used for Asserting prefixes and truncation. // Used for Asserting prefixes and truncation.
// Used for test case with prefix = "new" and maxKeys = 1, (testCase 31). // Used for test case with prefix = "new" and maxKeys = 1, (testCase 31).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
}, },
}, },
// ListObjectsResult-8. // ListObjectsResult-8.
// Used for Asserting prefixes. // Used for Asserting prefixes.
// Used for test case with prefix = "obj" and maxKeys = 2, (testCase 32). // Used for test case with prefix = "obj" and maxKeys = 2, (testCase 32).
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
}, },
}, },
// ListObjectsResult-9. // ListObjectsResult-9.
// Used for asserting the case with marker, but without prefix. // Used for asserting the case with marker, but without prefix.
//marker is set to "newPrefix0" in the testCase, (testCase 33). //marker is set to "newPrefix0" in the testCase, (testCase 33).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-10. // ListObjectsResult-10.
//marker is set to "newPrefix1" in the testCase, (testCase 34). //marker is set to "newPrefix1" in the testCase, (testCase 34).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-11. // ListObjectsResult-11.
//marker is set to "obj0" in the testCase, (testCase 35). //marker is set to "obj0" in the testCase, (testCase 35).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-12. // ListObjectsResult-12.
// Marker is set to "obj1" in the testCase, (testCase 36). // Marker is set to "obj1" in the testCase, (testCase 36).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-13. // ListObjectsResult-13.
// Marker is set to "man" in the testCase, (testCase37). // Marker is set to "man" in the testCase, (testCase37).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-14. // ListObjectsResult-14.
// Marker is set to "Abc" in the testCase, (testCase 39). // Marker is set to "Abc" in the testCase, (testCase 39).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-15. // ListObjectsResult-15.
// Marker is set to "Asia/India/India-summer-photos-1" in the testCase, (testCase 40). // Marker is set to "Asia/India/India-summer-photos-1" in the testCase, (testCase 40).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-16. // ListObjectsResult-16.
// Marker is set to "Asia/India/Karnataka/Bangalore/Koramangala/pics" in the testCase, (testCase 41). // Marker is set to "Asia/India/Karnataka/Bangalore/Koramangala/pics" in the testCase, (testCase 41).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-17. // ListObjectsResult-17.
// Used for asserting the case with marker, without prefix but with truncation. // Used for asserting the case with marker, without prefix but with truncation.
// Marker = "newPrefix0" & maxKeys = 3 in the testCase, (testCase42). // Marker = "newPrefix0" & maxKeys = 3 in the testCase, (testCase42).
// Output truncated to 3 values. // Output truncated to 3 values.
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
}, },
}, },
// ListObjectsResult-18. // ListObjectsResult-18.
// Marker = "newPrefix1" & maxkeys = 1 in the testCase, (testCase43). // Marker = "newPrefix1" & maxkeys = 1 in the testCase, (testCase43).
// Output truncated to 1 value. // Output truncated to 1 value.
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
}, },
}, },
// ListObjectsResult-19. // ListObjectsResult-19.
// Marker = "obj0" & maxKeys = 1 in the testCase, (testCase44). // Marker = "obj0" & maxKeys = 1 in the testCase, (testCase44).
// Output truncated to 1 value. // Output truncated to 1 value.
ListObjectsResult{ {
IsTruncated: true, IsTruncated: true,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
}, },
}, },
// ListObjectsResult-20. // ListObjectsResult-20.
// Marker = "obj0" & prefix = "obj" in the testCase, (testCase 45). // Marker = "obj0" & prefix = "obj" in the testCase, (testCase 45).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-21. // ListObjectsResult-21.
// Marker = "obj1" & prefix = "obj" in the testCase, (testCase 46). // Marker = "obj1" & prefix = "obj" in the testCase, (testCase 46).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-22. // ListObjectsResult-22.
// Marker = "newPrefix0" & prefix = "new" in the testCase,, (testCase 47). // Marker = "newPrefix0" & prefix = "new" in the testCase,, (testCase 47).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "newzen/zen/recurse/again/again/again/pics"}, {Name: "newzen/zen/recurse/again/again/again/pics"},
}, },
}, },
// ListObjectsResult-23. // ListObjectsResult-23.
// Prefix is set to "Asia/India/" in the testCase, and delimiter is not set (testCase 55). // Prefix is set to "Asia/India/" in the testCase, and delimiter is not set (testCase 55).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
}, },
}, },
// ListObjectsResult-24. // ListObjectsResult-24.
// Prefix is set to "Asia" in the testCase, and delimiter is not set (testCase 56). // Prefix is set to "Asia" in the testCase, and delimiter is not set (testCase 56).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
ObjectInfo{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"}, {Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
}, },
}, },
// ListObjectsResult-25. // ListObjectsResult-25.
// Prefix is set to "Asia" in the testCase, and delimiter is set (testCase 57). // Prefix is set to "Asia" in the testCase, and delimiter is set (testCase 57).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia-maps"}, {Name: "Asia-maps"},
}, },
}, },
// ListObjectsResult-26. // ListObjectsResult-26.
// prefix = "new" and delimiter is set in the testCase.(testCase 58). // prefix = "new" and delimiter is set in the testCase.(testCase 58).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
}, },
}, },
// ListObjectsResult-27. // ListObjectsResult-27.
// Prefix is set to "Asia/India/" in the testCase, and delimiter is set to forward slash '/' (testCase 59). // Prefix is set to "Asia/India/" in the testCase, and delimiter is set to forward slash '/' (testCase 59).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "Asia/India/India-summer-photos-1"}, {Name: "Asia/India/India-summer-photos-1"},
}, },
}, },
// ListObjectsResult-28. // ListObjectsResult-28.
// Marker is set to "Asia/India/India-summer-photos-1" and delimiter set in the testCase, (testCase 60). // Marker is set to "Asia/India/India-summer-photos-1" and delimiter set in the testCase, (testCase 60).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
// ListObjectsResult-29. // ListObjectsResult-29.
// Marker is set to "Asia/India/Karnataka/Bangalore/Koramangala/pics" in the testCase and delimeter set, (testCase 61). // Marker is set to "Asia/India/Karnataka/Bangalore/Koramangala/pics" in the testCase and delimeter set, (testCase 61).
ListObjectsResult{ {
IsTruncated: false, IsTruncated: false,
Objects: []ObjectInfo{ Objects: []ObjectInfo{
ObjectInfo{Name: "newPrefix0"}, {Name: "newPrefix0"},
ObjectInfo{Name: "newPrefix1"}, {Name: "newPrefix1"},
ObjectInfo{Name: "obj0"}, {Name: "obj0"},
ObjectInfo{Name: "obj1"}, {Name: "obj1"},
ObjectInfo{Name: "obj2"}, {Name: "obj2"},
}, },
}, },
} }
@ -459,8 +459,8 @@ func TestListObjects(t *testing.T) {
// The prefix and marker combination to be valid it should satisy strings.HasPrefix(marker, prefix). // The prefix and marker combination to be valid it should satisy strings.HasPrefix(marker, prefix).
{"test-bucket-list-object", "asia", "europe-object", "", 0, ListObjectsResult{}, fmt.Errorf("Invalid combination of marker '%s' and prefix '%s'", "europe-object", "asia"), false}, {"test-bucket-list-object", "asia", "europe-object", "", 0, ListObjectsResult{}, fmt.Errorf("Invalid combination of marker '%s' and prefix '%s'", "europe-object", "asia"), false},
// Setting a non-existing directory to be prefix (14-15). // Setting a non-existing directory to be prefix (14-15).
{"empty-bucket", "europe/france/", "", "", 1, ListObjectsResult{}, fmt.Errorf("%s:", filepath.FromSlash("/empty-bucket/europe/france")), false}, {"empty-bucket", "europe/france/", "", "", 1, ListObjectsResult{}, fmt.Errorf("%s", filepath.FromSlash("/empty-bucket/europe/france")), false},
{"empty-bucket", "europe/tunisia/", "", "", 1, ListObjectsResult{}, fmt.Errorf("%s:", filepath.FromSlash("/empty-bucket/europe/tunisia")), false}, {"empty-bucket", "europe/tunisia/", "", "", 1, ListObjectsResult{}, fmt.Errorf("%s", filepath.FromSlash("/empty-bucket/europe/tunisia")), false},
// Testing on empty bucket, that is, bucket without any objects in it (16). // Testing on empty bucket, that is, bucket without any objects in it (16).
{"empty-bucket", "", "", "", 0, ListObjectsResult{}, nil, true}, {"empty-bucket", "", "", "", 0, ListObjectsResult{}, nil, true},
// Setting maxKeys to negative value (17-18). // Setting maxKeys to negative value (17-18).

Loading…
Cancel
Save