mirror of
https://github.com/minio/minio.git
synced 2025-01-24 13:13:16 -05:00
Adding paging count tests
This commit is contained in:
parent
ef9968160e
commit
0da193e6d6
@ -95,6 +95,9 @@ func (storage *storage) ListObjects(bucket, prefix string, count int) []mstorage
|
||||
results = append(results, object.metadata)
|
||||
}
|
||||
}
|
||||
if len(results) == count {
|
||||
return results
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
@ -57,6 +57,20 @@ func testMultipleObjectCreation(c *C, create func() Storage) {
|
||||
}
|
||||
|
||||
func testPaging(c *C, create func() Storage) {
|
||||
storage := create()
|
||||
storage.StoreBucket("bucket")
|
||||
storage.ListObjects("bucket", "", 1000)
|
||||
c.Assert(len(storage.ListObjects("bucket", "", 1000)), Equals, 0)
|
||||
for i := 1; i <= 1000; i++ {
|
||||
key := "obj" + strconv.Itoa(i)
|
||||
storage.StoreObject("bucket", key, bytes.NewBufferString(key))
|
||||
c.Assert(len(storage.ListObjects("bucket", "", i)), Equals, i)
|
||||
}
|
||||
for i := 1001; i <= 2000; i++ {
|
||||
key := "obj" + strconv.Itoa(i)
|
||||
storage.StoreObject("bucket", key, bytes.NewBufferString(key))
|
||||
c.Assert(len(storage.ListObjects("bucket", "", 1000)), Equals, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
func testObjectOverwriteFails(c *C, create func() Storage) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user