From 4af1f4209c0865be5bab399bb4685fe5b620d03d Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 17:36:10 +0800 Subject: [PATCH] fix uint64 transfer to int64 --- meta/autoid/autoid_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 8fd5ffdcfbcaf..c3d0e9ed15047 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -15,6 +15,7 @@ package autoid_test import ( "fmt" + "math" "sync" "testing" "time" @@ -239,13 +240,12 @@ func (*testSuite) TestUnsignedAutoid(c *C) { c.Assert(id, Equals, int64(6544)) // Test the MaxUint64 is alloc upper bound but not rebase. - var n uint64 = 18446744073709551614 - var i interface{} = n - un := i.(int64) + var n uint64 = math.MaxInt64 - 1 + un := int64(n) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) _, err = alloc.Alloc(3) - c.Assert(alloc, NotNil) + un = int64(n + 1) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) }