From e27e55b18980563f2f04d2c441494204c53a72fc Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 10 Sep 2024 10:50:30 +0800 Subject: [PATCH] *: make `TestLeaderAndVoter` stable (#8609) close tikv/pd#8408 Signed-off-by: Ryan Leung --- tests/server/api/rule_test.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/server/api/rule_test.go b/tests/server/api/rule_test.go index f4d85d60361..7d00310d557 100644 --- a/tests/server/api/rule_test.go +++ b/tests/server/api/rule_test.go @@ -985,13 +985,7 @@ func (suite *ruleTestSuite) checkLeaderAndVoter(cluster *tests.TestCluster) { tu.StatusOK(re), tu.ExtractJSON(re, &respBundle)) re.NoError(err) re.Len(respBundle, 1) - if bundle[0].Rules[0].Role == placement.Leader { - return respBundle[0].Rules[0].Role == placement.Leader - } - if bundle[0].Rules[0].Role == placement.Voter { - return respBundle[0].Rules[0].Role == placement.Voter - } - return false + return compareBundle(respBundle[0], bundle[0]) }) } }