From 9ede7e56c8174bc0888f76fb3c24059eb4b375d4 Mon Sep 17 00:00:00 2001 From: winkyao Date: Thu, 29 Mar 2018 10:19:57 +0800 Subject: [PATCH] test_util: use real uuid in mocktikv. (#6174) --- store/tikv/test_util.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/store/tikv/test_util.go b/store/tikv/test_util.go index f19337727c..d461e732f8 100644 --- a/store/tikv/test_util.go +++ b/store/tikv/test_util.go @@ -14,13 +14,10 @@ package tikv import ( - "fmt" - "math/rand" - "time" - "github.com/juju/errors" "github.com/pingcap/pd/pd-client" "github.com/pingcap/tidb/kv" + "github.com/twinj/uuid" ) // NewTestTiKVStore creates a test store with Option @@ -35,11 +32,9 @@ func NewTestTiKVStore(client Client, pdClient pd.Client, clientHijack func(Clien } // Make sure the uuid is unique. - partID := fmt.Sprintf("%05d", rand.Intn(100000)) - uuid := fmt.Sprintf("mocktikv-store-%v-%v", time.Now().Unix(), partID) - + uid := uuid.NewV4().String() spkv := NewMockSafePointKV() - tikvStore, err := newTikvStore(uuid, pdCli, spkv, client, false) + tikvStore, err := newTikvStore(uid, pdCli, spkv, client, false) tikvStore.mock = true return tikvStore, errors.Trace(err) }