aboutsummaryrefslogtreecommitdiff
path: root/bucket_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-03-01 09:21:11 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-03-01 09:21:11 -0700
commit7214e089c0f78fce8fb1e00f09f7d2b54c88bdbe (patch)
tree75850081fdb236f37c82d6e8fcd4cde5b81354d8 /bucket_test.go
parentMerge branch 'master' of https://github.com/boltdb/bolt (diff)
parentAllow reads of unflushed nodes. (diff)
downloaddedo-7214e089c0f78fce8fb1e00f09f7d2b54c88bdbe.tar.gz
dedo-7214e089c0f78fce8fb1e00f09f7d2b54c88bdbe.tar.xz
Merge pull request #57 from benbjohnson/node-aware-cursors
Allow reads of unflushed nodes.
Diffstat (limited to 'bucket_test.go')
-rw-r--r--bucket_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/bucket_test.go b/bucket_test.go
index 5a2c0ae..e4ccabd 100644
--- a/bucket_test.go
+++ b/bucket_test.go
@@ -23,6 +23,20 @@ func TestBucketGetNonExistent(t *testing.T) {
})
}
+// Ensure that a bucket can read a value that is not flushed yet.
+func TestBucketGetFromNode(t *testing.T) {
+ withOpenDB(func(db *DB, path string) {
+ db.CreateBucket("widgets")
+ db.Do(func(txn *RWTransaction) error {
+ b := txn.Bucket("widgets")
+ b.Put([]byte("foo"), []byte("bar"))
+ value := b.Get([]byte("foo"))
+ assert.Equal(t, value, []byte("bar"))
+ return nil
+ })
+ })
+}
+
// Ensure that a bucket can write a key/value.
func TestBucketPut(t *testing.T) {
withOpenDB(func(db *DB, path string) {