Adding paging count tests

master
Frederick F. Kautz IV 10 years ago
parent ef9968160e
commit 0da193e6d6
  1. 3
      pkg/storage/inmemory/inmemory.go
  2. 14
      pkg/storage/storage_api_suite.go

@ -95,6 +95,9 @@ func (storage *storage) ListObjects(bucket, prefix string, count int) []mstorage
results = append(results, object.metadata) results = append(results, object.metadata)
} }
} }
if len(results) == count {
return results
}
} }
return results return results
} }

@ -57,6 +57,20 @@ func testMultipleObjectCreation(c *C, create func() Storage) {
} }
func testPaging(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) { func testObjectOverwriteFails(c *C, create func() Storage) {

Loading…
Cancel
Save