Skip to content

Commit

Permalink
store/tikv: make lock TTL test more stable. (pingcap#2595)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored Feb 6, 2017
1 parent 8bafc3d commit 5b84277
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion store/tikv/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,14 @@ func (s *testLockSuite) TestLockTTL(c *C) {
s.ttlEquals(c, l.TTL, uint64(ttlFactor*2)+uint64(time.Since(start)/time.Millisecond))

// Txn with long read time.
start = time.Now()
txn, err = s.store.Begin()
c.Assert(err, IsNil)
time.Sleep(time.Millisecond * 50)
txn.Set(kv.Key("key"), []byte("value"))
s.prewriteTxn(c, txn.(*tikvTxn))
l = s.mustGetLock(c, []byte("key"))
s.ttlEquals(c, l.TTL, defaultLockTTL+50)
s.ttlEquals(c, l.TTL, defaultLockTTL+uint64(time.Since(start)/time.Millisecond))
}

func init() {
Expand Down

0 comments on commit 5b84277

Please sign in to comment.