@ -51,20 +51,21 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
testObjects := [ ] struct {
testObjects := [ ] struct {
name string
name string
content string
content string
meta map [ string ] string
} {
} {
{ "Asia-maps" , "asis-maps" } ,
{ "Asia-maps.png " , "asis-maps" , map [ string ] string { "content-type" : "image/png" } } ,
{ "Asia/India/India-summer-photos-1" , "contentstring" } ,
{ "Asia/India/India-summer-photos-1" , "contentstring" , nil } ,
{ "Asia/India/Karnataka/Bangalore/Koramangala/pics" , "contentstring" } ,
{ "Asia/India/Karnataka/Bangalore/Koramangala/pics" , "contentstring" , nil } ,
{ "newPrefix0" , "newPrefix0" } ,
{ "newPrefix0" , "newPrefix0" , nil } ,
{ "newPrefix1" , "newPrefix1" } ,
{ "newPrefix1" , "newPrefix1" , nil } ,
{ "newzen/zen/recurse/again/again/again/pics" , "recurse" } ,
{ "newzen/zen/recurse/again/again/again/pics" , "recurse" , nil } ,
{ "obj0" , "obj0" } ,
{ "obj0" , "obj0" , nil } ,
{ "obj1" , "obj1" } ,
{ "obj1" , "obj1" , nil } ,
{ "obj2" , "obj2" } ,
{ "obj2" , "obj2" , nil } ,
}
}
sha256sum := ""
sha256sum := ""
for _ , object := range testObjects {
for _ , object := range testObjects {
_ , err = obj . PutObject ( testBuckets [ 0 ] , object . name , int64 ( len ( object . content ) ) , bytes . NewBufferString ( object . content ) , nil , sha256sum )
_ , err = obj . PutObject ( testBuckets [ 0 ] , object . name , int64 ( len ( object . content ) ) , bytes . NewBufferString ( object . content ) , object . meta , sha256sum )
if err != nil {
if err != nil {
t . Fatalf ( "%s : %s" , instanceType , err . Error ( ) )
t . Fatalf ( "%s : %s" , instanceType , err . Error ( ) )
}
}
@ -80,7 +81,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : false ,
IsTruncated : false ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "newPrefix0" } ,
{ Name : "newPrefix0" } ,
@ -96,7 +97,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : true ,
IsTruncated : true ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "newPrefix0" } ,
{ Name : "newPrefix0" } ,
@ -108,7 +109,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : true ,
IsTruncated : true ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "newPrefix0" } ,
{ Name : "newPrefix0" } ,
@ -119,7 +120,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : true ,
IsTruncated : true ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
} ,
} ,
@ -130,7 +131,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : true ,
IsTruncated : true ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
} ,
} ,
} ,
} ,
// ListObjectsResult-5.
// ListObjectsResult-5.
@ -233,7 +234,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : false ,
IsTruncated : false ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "newPrefix0" } ,
{ Name : "newPrefix0" } ,
@ -342,7 +343,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : false ,
IsTruncated : false ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/India-summer-photos-1" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
{ Name : "Asia/India/Karnataka/Bangalore/Koramangala/pics" } ,
} ,
} ,
@ -353,7 +354,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
{
IsTruncated : false ,
IsTruncated : false ,
Objects : [ ] ObjectInfo {
Objects : [ ] ObjectInfo {
{ Name : "Asia-maps" } ,
{ Name : "Asia-maps.png" , ContentType : "image/png " } ,
} ,
} ,
} ,
} ,
// ListObjectsResult-26.
// ListObjectsResult-26.
@ -548,6 +549,10 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
if testCase . result . Objects [ j ] . Name != result . Objects [ j ] . Name {
if testCase . result . Objects [ j ] . Name != result . Objects [ j ] . Name {
t . Errorf ( "Test %d: %s: Expected object name to be \"%s\", but found \"%s\" instead" , i + 1 , instanceType , testCase . result . Objects [ j ] . Name , result . Objects [ j ] . Name )
t . Errorf ( "Test %d: %s: Expected object name to be \"%s\", but found \"%s\" instead" , i + 1 , instanceType , testCase . result . Objects [ j ] . Name , result . Objects [ j ] . Name )
}
}
if testCase . result . Objects [ j ] . ContentType != result . Objects [ j ] . ContentType {
t . Errorf ( "Test %d: %s: Expected object contentType to be \"%s\", but found \"%s\" instead" , i + 1 , instanceType , testCase . result . Objects [ j ] . ContentType , result . Objects [ j ] . ContentType )
}
}
}
if testCase . result . IsTruncated != result . IsTruncated {
if testCase . result . IsTruncated != result . IsTruncated {
t . Errorf ( "Test %d: %s: Expected IsTruncated flag to be %v, but instead found it to be %v" , i + 1 , instanceType , testCase . result . IsTruncated , result . IsTruncated )
t . Errorf ( "Test %d: %s: Expected IsTruncated flag to be %v, but instead found it to be %v" , i + 1 , instanceType , testCase . result . IsTruncated , result . IsTruncated )