aboutsummaryrefslogtreecommitdiff
path: root/node_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-09 07:55:01 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-09 07:55:01 -0600
commitc595561faae918374670ed667c64a7b95bbde9df (patch)
tree3f5cd7d56f0fefda38ca83b71d8fdc6362152b7c /node_test.go
parentMerge pull request #159 from Shopify/pgid_overflow_checks (diff)
downloaddedo-c595561faae918374670ed667c64a7b95bbde9df.tar.gz
dedo-c595561faae918374670ed667c64a7b95bbde9df.tar.xz
Fix node unit tests.
Diffstat (limited to 'node_test.go')
-rw-r--r--node_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/node_test.go b/node_test.go
index f639376..1393e2a 100644
--- a/node_test.go
+++ b/node_test.go
@@ -9,7 +9,7 @@ import (
// Ensure that a node can insert a key/value.
func TestNode_put(t *testing.T) {
- n := &node{inodes: make(inodes, 0)}
+ n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{meta: &meta{pgid: 1}}}}
n.put([]byte("baz"), []byte("baz"), []byte("2"), 0, 0)
n.put([]byte("foo"), []byte("foo"), []byte("0"), 0, 0)
n.put([]byte("bar"), []byte("bar"), []byte("1"), 0, 0)
@@ -58,7 +58,7 @@ func TestNode_read_LeafPage(t *testing.T) {
// Ensure that a node can serialize into a leaf page.
func TestNode_write_LeafPage(t *testing.T) {
// Create a node.
- n := &node{isLeaf: true, inodes: make(inodes, 0)}
+ n := &node{isLeaf: true, inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{meta: &meta{pgid: 1}}}}
n.put([]byte("susy"), []byte("susy"), []byte("que"), 0, 0)
n.put([]byte("ricki"), []byte("ricki"), []byte("lake"), 0, 0)
n.put([]byte("john"), []byte("john"), []byte("johnson"), 0, 0)
@@ -85,7 +85,7 @@ func TestNode_write_LeafPage(t *testing.T) {
// Ensure that a node can split into appropriate subgroups.
func TestNode_split(t *testing.T) {
// Create a node.
- n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{}}}
+ n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{meta: &meta{pgid: 1}}}}
n.put([]byte("00000001"), []byte("00000001"), []byte("0123456701234567"), 0, 0)
n.put([]byte("00000002"), []byte("00000002"), []byte("0123456701234567"), 0, 0)
n.put([]byte("00000003"), []byte("00000003"), []byte("0123456701234567"), 0, 0)
@@ -104,7 +104,7 @@ func TestNode_split(t *testing.T) {
// Ensure that a page with the minimum number of inodes just returns a single node.
func TestNode_split_MinKeys(t *testing.T) {
// Create a node.
- n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{}}}
+ n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{meta: &meta{pgid: 1}}}}
n.put([]byte("00000001"), []byte("00000001"), []byte("0123456701234567"), 0, 0)
n.put([]byte("00000002"), []byte("00000002"), []byte("0123456701234567"), 0, 0)
@@ -116,7 +116,7 @@ func TestNode_split_MinKeys(t *testing.T) {
// Ensure that a node that has keys that all fit on a page just returns one leaf.
func TestNode_split_SinglePage(t *testing.T) {
// Create a node.
- n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{}}}
+ n := &node{inodes: make(inodes, 0), bucket: &Bucket{tx: &Tx{meta: &meta{pgid: 1}}}}
n.put([]byte("00000001"), []byte("00000001"), []byte("0123456701234567"), 0, 0)
n.put([]byte("00000002"), []byte("00000002"), []byte("0123456701234567"), 0, 0)
n.put([]byte("00000003"), []byte("00000003"), []byte("0123456701234567"), 0, 0)