Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: 5kbpers <tangminghua@pingcap.com>
  • Loading branch information
5kbpers committed Nov 6, 2019
1 parent 8264591 commit 17721c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/api/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ type testTSOSuite struct {
urlPrefix string
}

func makeTS(offset time.Duration) int64 {
func makeTS(offset time.Duration) uint64 {
physical := time.Now().Add(offset).UnixNano() / int64(time.Millisecond)
return physical << 18
return uint64(physical << 18)
}

func (s *testTSOSuite) SetUpSuite(c *C) {
Expand All @@ -115,7 +115,7 @@ func (s *testTSOSuite) TestResetTS(c *C) {
args := make(map[string]interface{})
t1 := makeTS(time.Hour)
url := s.urlPrefix
args["tso"] = fmt.Sprintf("%d", uint64(t1))
args["tso"] = fmt.Sprintf("%d", t1)
values, err := json.Marshal(args)
c.Assert(err, IsNil)
err = postJSON(url, values,
Expand All @@ -126,7 +126,7 @@ func (s *testTSOSuite) TestResetTS(c *C) {

c.Assert(err, IsNil)
t2 := makeTS(32 * time.Hour)
args["tso"] = fmt.Sprintf("%d", uint64(t2))
args["tso"] = fmt.Sprintf("%d", t2)
values, err = json.Marshal(args)
c.Assert(err, IsNil)
err = postJSON(url, values,
Expand All @@ -135,7 +135,7 @@ func (s *testTSOSuite) TestResetTS(c *C) {
c.Assert(strings.Contains(err.Error(), "too large"), IsTrue)

t3 := makeTS(-2 * time.Hour)
args["tso"] = fmt.Sprintf("%d", uint64(t3))
args["tso"] = fmt.Sprintf("%d", t3)
values, err = json.Marshal(args)
c.Assert(err, IsNil)
err = postJSON(url, values,
Expand All @@ -144,7 +144,7 @@ func (s *testTSOSuite) TestResetTS(c *C) {
c.Assert(strings.Contains(err.Error(), "small"), IsTrue)

t4 := math.MinInt64
args["tso"] = fmt.Sprintf("%d", uint64(t4))
args["tso"] = fmt.Sprintf("%d", t4)
values, err = json.Marshal(args)
c.Assert(err, IsNil)
err = postJSON(url, values,
Expand Down

0 comments on commit 17721c1

Please sign in to comment.