Skip to content

Commit d08263d

Browse files
committed
tests: fix PR 10963 CI failures
Signed-off-by: Ryan Leung <rleungx@gmail.com>
1 parent 06d65bb commit d08263d

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

pkg/mcs/server/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,13 @@ func replacePort(addr, actualListenAddr string) string {
268268
return net.JoinHostPort(host, actualPort)
269269
}
270270

271-
func splitHostPort(addr string) (string, string, bool) {
271+
func splitHostPort(addr string) (host, port string, ok bool) {
272272
parsed, err := url.Parse(addr)
273-
host := addr
273+
host = addr
274274
if err == nil && parsed.Host != "" {
275275
host = parsed.Host
276276
}
277-
_, port, err := net.SplitHostPort(host)
277+
_, port, err = net.SplitHostPort(host)
278278
if err != nil {
279279
return "", "", false
280280
}

tools/pd-ctl/tests/store/store_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/tikv/pd/pkg/response"
3636
"github.com/tikv/pd/pkg/statistics/utils"
3737
"github.com/tikv/pd/pkg/utils/grpcutil"
38+
"github.com/tikv/pd/pkg/utils/testutil"
3839
"github.com/tikv/pd/server/config"
3940
pdTests "github.com/tikv/pd/tests"
4041
ctl "github.com/tikv/pd/tools/pd-ctl/pdctl"
@@ -285,9 +286,11 @@ func (s *storeTestSuite) checkStore(cluster *pdTests.TestCluster) {
285286
re.NoError(leaderServer.Run())
286287

287288
re.NotEmpty(cluster.WaitLeader())
288-
storesLimit := leaderServer.GetPersistOptions().GetAllStoresLimit()
289-
re.Equal(float64(20), storesLimit[1].AddPeer)
290-
re.Equal(float64(20), storesLimit[1].RemovePeer)
289+
testutil.Eventually(re, func() bool {
290+
storesLimit := leaderServer.GetPersistOptions().GetAllStoresLimit()
291+
limit, ok := storesLimit[1]
292+
return ok && limit.AddPeer == float64(20) && limit.RemovePeer == float64(20)
293+
})
291294

292295
// store limit all <rate> <type>
293296
args = []string{"-u", pdAddr, "store", "limit", "all", "25", "remove-peer"}

0 commit comments

Comments
 (0)