aboutsummaryrefslogtreecommitdiff
path: root/bucket_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'bucket_test.go')
-rw-r--r--bucket_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/bucket_test.go b/bucket_test.go
index 8fcf84c..b87031b 100644
--- a/bucket_test.go
+++ b/bucket_test.go
@@ -161,6 +161,33 @@ func TestBucket_Delete(t *testing.T) {
})
}
+// Ensure that deleting a large set of keys will work correctly.
+func TestBucket_Delete_Large(t *testing.T) {
+ withOpenDB(func(db *DB, path string) {
+ db.Update(func(tx *Tx) error {
+ var b, _ = tx.CreateBucket([]byte("widgets"))
+ for i := 0; i < 100; i++ {
+ assert.NoError(t, b.Put([]byte(strconv.Itoa(i)), []byte(strings.Repeat("*", 1024))))
+ }
+ return nil
+ })
+ db.Update(func(tx *Tx) error {
+ var b = tx.Bucket([]byte("widgets"))
+ for i := 0; i < 100; i++ {
+ assert.NoError(t, b.Delete([]byte(strconv.Itoa(i))))
+ }
+ return nil
+ })
+ db.View(func(tx *Tx) error {
+ var b = tx.Bucket([]byte("widgets"))
+ for i := 0; i < 100; i++ {
+ assert.Nil(t, b.Get([]byte(strconv.Itoa(i))))
+ }
+ return nil
+ })
+ })
+}
+
// Ensure that accessing and updating nested buckets is ok across transactions.
func TestBucket_Nested(t *testing.T) {
withOpenDB(func(db *DB, path string) {