storage: address barak's comments

This commit is contained in:
Xiang Li
2015-05-20 17:32:53 -07:00
parent 845cb61213
commit e332e86b5d
5 changed files with 65 additions and 86 deletions

View File

@ -27,35 +27,3 @@ func TestBackendPut(t *testing.T) {
batchTx.Unlock()
}
func TestBackendForceCommit(t *testing.T) {
backend := New("test", 10*time.Second, 10000)
defer backend.Close()
defer os.Remove("test")
v := []byte("foo")
batchTx := backend.BatchTx()
batchTx.Lock()
batchTx.UnsafeCreateBucket([]byte("test"))
batchTx.UnsafePut([]byte("test"), []byte("foo"), v)
batchTx.Unlock()
// expect to see nothing that the batch tx created
tx := backend.ReadTnx()
gbucket := tx.Bucket([]byte("test"))
if gbucket != nil {
t.Errorf("readtx.bu = %p, want nil", gbucket)
}
tx.Commit()
// commit batch tx
backend.ForceCommit()
tx = backend.ReadTnx()
gbucket = tx.Bucket([]byte("test"))
if gbucket == nil {
t.Errorf("readtx.bu = nil, want not nil")
}
}