From b00aef27d29bb959c22aa47c33663689891a15b9 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 9 Aug 2023 11:44:23 +0800 Subject: [PATCH] fix conflict Signed-off-by: lhy1024 --- go.mod | 2 +- go.sum | 3 --- server/api/region_test.go | 10 ++++------ server/core/test_util.go | 16 ++++++++++++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 1f014c349a8..c4a56de1ce5 100644 --- a/go.mod +++ b/go.mod @@ -51,6 +51,7 @@ require ( ) require ( + github.com/google/go-cmp v0.5.9 // indirect github.com/samber/lo v1.37.0 // indirect gorm.io/datatypes v1.1.0 // indirect ) @@ -115,7 +116,6 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/leodido/go-urn v1.2.0 // indirect - github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect github.com/mailru/easyjson v0.7.6 github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-isatty v0.0.12 // indirect diff --git a/go.sum b/go.sum index 940c431ad6b..3be16d3d55b 100644 --- a/go.sum +++ b/go.sum @@ -307,9 +307,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= diff --git a/server/api/region_test.go b/server/api/region_test.go index 9cf804c7d74..8527acf41ec 100644 --- a/server/api/region_test.go +++ b/server/api/region_test.go @@ -33,10 +33,8 @@ import ( "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/tikv/pd/pkg/core" - "github.com/tikv/pd/pkg/schedule/placement" - "github.com/tikv/pd/pkg/utils/apiutil" - tu "github.com/tikv/pd/pkg/utils/testutil" + "github.com/tikv/pd/pkg/apiutil" + tu "github.com/tikv/pd/pkg/testutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/core" "github.com/tikv/pd/server/schedule/placement" @@ -475,7 +473,7 @@ func TestRegionsWithKillRequest(t *testing.T) { mustBootstrapCluster(re, svr) regionCount := 100000 for i := 0; i < regionCount; i++ { - r := core.NewTestRegionInfo(uint64(i+2), 1, + r := core.NewTestRegionInfoWithID(uint64(i+2), 1, []byte(fmt.Sprintf("%09d", i)), []byte(fmt.Sprintf("%09d", i+1)), core.SetApproximateKeys(10), core.SetApproximateSize(10)) @@ -864,7 +862,7 @@ func BenchmarkGetRegions(b *testing.B) { mustBootstrapCluster(re, svr) regionCount := 1000000 for i := 0; i < regionCount; i++ { - r := core.NewTestRegionInfo(uint64(i+2), 1, + r := core.NewTestRegionInfoWithID(uint64(i+2), 1, []byte(fmt.Sprintf("%09d", i)), []byte(fmt.Sprintf("%09d", i+1)), core.SetApproximateKeys(10), core.SetApproximateSize(10)) diff --git a/server/core/test_util.go b/server/core/test_util.go index 055623edca4..9a72702c294 100644 --- a/server/core/test_util.go +++ b/server/core/test_util.go @@ -85,6 +85,22 @@ func NewTestRegionInfo(start, end []byte) *RegionInfo { }} } +// NewTestRegionInfoWithID creates a new RegionInfo for test purpose. +func NewTestRegionInfoWithID(regionID, storeID uint64, start, end []byte, opts ...RegionCreateOption) *RegionInfo { + leader := &metapb.Peer{ + Id: regionID, + StoreId: storeID, + } + metaRegion := &metapb.Region{ + Id: regionID, + StartKey: start, + EndKey: end, + Peers: []*metapb.Peer{leader}, + RegionEpoch: &metapb.RegionEpoch{ConfVer: 1, Version: 1}, + } + return NewRegionInfo(metaRegion, leader, opts...) +} + // NewStoreInfoWithDisk is created with all disk infos. func NewStoreInfoWithDisk(id, used, available, capacity, regionSize uint64) *StoreInfo { stats := &pdpb.StoreStats{}