Skip to content

Commit

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

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

Expand Down Expand Up @@ -60,10 +61,13 @@ 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)
ms := oracle.ExtractPhysical(ts)
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, time.Unix(ms/1e3, (ms%1e3)*1e6)))

currVer := reload(validator, leaseGrantCh, 0)
valid = validator.Check(ts, item.schemaVer, []int64{0})
Expand Down

0 comments on commit a804be8

Please sign in to comment.