mvcc: test inflight Hash to trigger Size on nil db

This commit is contained in:
Gyu-Ho Lee 2016-10-21 11:02:09 -07:00
parent 7d30326968
commit 994e8e4f40

View File

@ -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{},