Ensure that a bucket can read a value that is not flushed yet.
(t *testing.T)
| 41 | |
| 42 | // Ensure that a bucket can read a value that is not flushed yet. |
| 43 | func TestBucket_Get_FromNode(t *testing.T) { |
| 44 | db := btesting.MustCreateDB(t) |
| 45 | |
| 46 | if err := db.Update(func(tx *bolt.Tx) error { |
| 47 | b, err := tx.CreateBucket([]byte("widgets")) |
| 48 | if err != nil { |
| 49 | t.Fatal(err) |
| 50 | } |
| 51 | if err := b.Put([]byte("foo"), []byte("bar")); err != nil { |
| 52 | t.Fatal(err) |
| 53 | } |
| 54 | if v := b.Get([]byte("foo")); !bytes.Equal(v, []byte("bar")) { |
| 55 | t.Fatalf("unexpected value: %v", v) |
| 56 | } |
| 57 | return nil |
| 58 | }); err != nil { |
| 59 | t.Fatal(err) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Ensure that a bucket retrieved via Get() returns a nil. |
| 64 | func TestBucket_Get_IncompatibleValue(t *testing.T) { |
nothing calls this directly
no test coverage detected