Skip to content

Commit

Permalink
mvcc: test inflight Hash to trigger Size on nil db
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Oct 21, 2016
1 parent 7d30326 commit 994e8e4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mvcc/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,20 @@ func newTestKeyBytes(rev revision, tombstone bool) []byte {
return bytes
}

// TestStoreHashAfterForceCommit ensures that later Hash call to
// closed backend with ForceCommit does not panic.
func TestStoreHashAfterForceCommit(t *testing.T) {
be, tmpPath := backend.NewDefaultTmpBackend()
kv := NewStore(be, &lease.FakeLessor{}, nil)
defer os.Remove(tmpPath)

// as in EtcdServer.HardStop
kv.Close()
be.Close()

kv.Hash()
}

func newFakeStore() *store {
b := &fakeBackend{&fakeBatchTx{
Recorder: &testutil.RecorderBuffered{},
Expand Down

0 comments on commit 994e8e4

Please sign in to comment.