Skip to content

Commit

Permalink
mvcc: test racey Hash call to backend panic
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Oct 20, 2016
1 parent 023da92 commit 9195a46
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 @@ -515,6 +515,20 @@ func TestTxnBlockBackendForceCommit(t *testing.T) {
}
}

// 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()
}

// TODO: test attach key to lessor

func newTestRevBytes(rev revision) []byte {
Expand Down

0 comments on commit 9195a46

Please sign in to comment.