Skip to content

Commit

Permalink
domain: make TestSchemaValidator stable (#8334)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and zz-jason committed Nov 20, 2018
1 parent 3e0e7d5 commit 4ff58ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions domain/schema_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"time"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/store/tikv/oracle"
"github.com/pingcap/tidb/util/testleak"
)

Expand Down Expand Up @@ -63,10 +64,12 @@ func (*testSuite) TestSchemaValidator(c *C) {
validator.Restart()

// Sleep for a long time, check schema is invalid.
ts := <-oracleCh // Make sure that ts has timed out a lease.
time.Sleep(lease)
ts := <-oracleCh
ts = <-oracleCh
valid = validator.Check(ts, item.schemaVer, []int64{10})
c.Assert(valid, Equals, ResultUnknown)
c.Assert(valid, Equals, ResultUnknown, Commentf("validator latest schema ver %v, time %v, item schema ver %v, ts %v",
validator.latestSchemaVer, validator.latestSchemaExpire, item.schemaVer, oracle.GetTimeFromTS(ts)))

currVer := reload(validator, leaseGrantCh, 0)
valid = validator.Check(ts, item.schemaVer, nil)
Expand Down

0 comments on commit 4ff58ea

Please sign in to comment.