diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index cb036e8b042..fc07436b92f 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -500,6 +500,9 @@ func (suite *serverTestSuite) TestStoreLimit() { defer tc.Destroy() leaderServer := suite.pdLeader.GetServer() tc.WaitForPrimaryServing(re) + testutil.Eventually(re, func() bool { + return leaderServer.GetRaftCluster().IsServiceIndependent(constant.SchedulingServiceName) + }) oc := tc.GetPrimaryServer().GetCluster().GetCoordinator().GetOperatorController() conf := leaderServer.GetReplicationConfig().Clone() diff --git a/tests/scheduling_cluster.go b/tests/scheduling_cluster.go index 3f7c39eb81c..23a59d564b8 100644 --- a/tests/scheduling_cluster.go +++ b/tests/scheduling_cluster.go @@ -107,7 +107,7 @@ func (tc *TestSchedulingCluster) WaitForPrimaryServing(re *require.Assertions) * var primary *scheduling.Server testutil.Eventually(re, func() bool { for _, server := range tc.servers { - if server.IsServing() { + if server.IsServing() && server.GetCoordinator().AreSchedulersInitialized() { primary = server return true }