1515import org .elasticsearch .action .admin .indices .stats .IndicesStatsAction ;
1616import org .elasticsearch .action .admin .indices .stats .ShardStats ;
1717import org .elasticsearch .action .admin .indices .stats .TransportIndicesStatsAction ;
18- import org .elasticsearch .cluster .ClusterInfoService ;
19- import org .elasticsearch .cluster .ClusterInfoServiceUtils ;
20- import org .elasticsearch .cluster .InternalClusterInfoService ;
2118import org .elasticsearch .cluster .NodeUsageStatsForThreadPools ;
2219import org .elasticsearch .cluster .metadata .IndexMetadata ;
2320import org .elasticsearch .cluster .node .DiscoveryNode ;
@@ -241,7 +238,7 @@ public void testHighNodeWriteLoadPreventsNewShardAllocation() {
241238 */
242239
243240 logger .info ("---> Refreshing the cluster info to pull in the dummy thread pool stats with a hot-spotting node" );
244- refreshClusterInfo (masterName );
241+ refreshClusterInfo ();
245242
246243 logger .info (
247244 "---> Update the filter to exclude " + firstDataNodeName + " so that shards will be reassigned away to the other nodes"
@@ -271,12 +268,10 @@ public void testMaxQueueLatencyMetricIsPublished() {
271268 WriteLoadConstraintSettings .WriteLoadDeciderStatus .ENABLED
272269 )
273270 .build ();
274- final String masterName = internalCluster ().startMasterOnlyNode (settings );
275- final var dataNodes = internalCluster ().startDataOnlyNodes (2 , settings );
276- ensureStableCluster (3 );
271+ final var dataNodes = internalCluster ().startNodes (3 , settings );
277272
278273 // Refresh cluster info (should trigger polling)
279- refreshClusterInfo (masterName );
274+ refreshClusterInfo ();
280275
281276 Map <String , Long > mostRecentQueueLatencyMetrics = getMostRecentQueueLatencyMetrics (dataNodes );
282277 assertThat (mostRecentQueueLatencyMetrics .keySet (), hasSize (dataNodes .size ()));
@@ -295,20 +290,12 @@ public void testMaxQueueLatencyMetricIsPublished() {
295290 // Unblock the pool
296291 latch .countDown ();
297292
298- refreshClusterInfo (masterName );
293+ refreshClusterInfo ();
299294 mostRecentQueueLatencyMetrics = getMostRecentQueueLatencyMetrics (dataNodes );
300295 assertThat (mostRecentQueueLatencyMetrics .keySet (), hasSize (dataNodes .size ()));
301296 assertThat (mostRecentQueueLatencyMetrics .get (dataNodeToDelay ), greaterThanOrEqualTo (delayMillis ));
302297 }
303298
304- private static void refreshClusterInfo (String masterName ) {
305- final InternalClusterInfoService clusterInfoService = asInstanceOf (
306- InternalClusterInfoService .class ,
307- internalCluster ().getInstance (ClusterInfoService .class , masterName )
308- );
309- ClusterInfoServiceUtils .refresh (clusterInfoService );
310- }
311-
312299 private static Map <String , Long > getMostRecentQueueLatencyMetrics (List <String > dataNodes ) {
313300 final Map <String , Long > measurements = new HashMap <>();
314301 for (String nodeName : dataNodes ) {
0 commit comments