diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index 57306640394..4a19321ce57 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -106,6 +106,7 @@ func (suite *serverTestSuite) TestAllocIDAfterLeaderChange() { pd2, err := suite.cluster.Join(suite.ctx) re.NoError(err) err = pd2.Run() + re.NotEmpty(suite.cluster.WaitLeader()) re.NoError(err) tc, err := tests.NewTestSchedulingCluster(suite.ctx, 1, suite.backendEndpoints) re.NoError(err) diff --git a/tests/server/join/join_test.go b/tests/server/join/join_test.go index 1eaa59a4e2a..5d087caf5e4 100644 --- a/tests/server/join/join_test.go +++ b/tests/server/join/join_test.go @@ -58,6 +58,7 @@ func TestSimpleJoin(t *testing.T) { re.NoError(err) _, err = os.Stat(filepath.Join(pd2.GetConfig().DataDir, "join")) re.False(os.IsNotExist(err)) + re.NotEmpty(cluster.WaitLeader()) members, err = etcdutil.ListEtcdMembers(ctx, client) re.NoError(err) re.Len(members.Members, 2) @@ -73,6 +74,7 @@ func TestSimpleJoin(t *testing.T) { re.NoError(err) _, err = os.Stat(filepath.Join(pd3.GetConfig().DataDir, "join")) re.False(os.IsNotExist(err)) + re.NotEmpty(cluster.WaitLeader()) members, err = etcdutil.ListEtcdMembers(ctx, client) re.NoError(err) re.Len(members.Members, 3) diff --git a/tests/server/watch/leader_watch_test.go b/tests/server/watch/leader_watch_test.go index 863cf7a0c08..39c54b5c500 100644 --- a/tests/server/watch/leader_watch_test.go +++ b/tests/server/watch/leader_watch_test.go @@ -57,6 +57,7 @@ func TestWatcher(t *testing.T) { re.NoError(failpoint.Enable("github.com/tikv/pd/server/delayWatcher", `pause`)) err = pd3.Run() re.NoError(err) + re.NotEmpty(cluster.WaitLeader()) time.Sleep(200 * time.Millisecond) re.Equal(pd1.GetConfig().Name, pd3.GetLeader().GetName()) err = pd1.Stop()