Skip to content

Commit

Permalink
[Test] Ensure latest cluster info is used in tests (#116908)
Browse files Browse the repository at this point in the history
DesiredBalanceMetrics#updateMetrics is called on reroute which is
frequent but not guaranteed. It can also take some time to complete.
This PR adds an explicit reroute to ensure the latest cluster info is
picked up.

Resolves: #116870
  • Loading branch information
ywangd authored Nov 18, 2024
1 parent c1c59eb commit c32b300
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ tests:
- class: org.elasticsearch.index.mapper.vectors.MultiDenseVectorScriptDocValuesTests
method: testFloatGetVectorValueAndGetMagnitude
issue: https://github.com/elastic/elasticsearch/issues/116863
- class: org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceReconcilerMetricsIT
method: testDesiredBalanceMetrics
issue: https://github.com/elastic/elasticsearch/issues/116870
- class: org.elasticsearch.xpack.inference.InferenceRestIT
method: test {p0=inference/30_semantic_text_inference/Calculates embeddings using the default ELSER 2 endpoint}
issue: https://github.com/elastic/elasticsearch/issues/116542
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

package org.elasticsearch.cluster.routing.allocation.allocator;

import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteUtils;
import org.elasticsearch.cluster.ClusterInfoService;
import org.elasticsearch.cluster.ClusterInfoServiceUtils;
import org.elasticsearch.cluster.InternalClusterInfoService;
Expand Down Expand Up @@ -68,6 +69,7 @@ public void testDesiredBalanceMetrics() {
final var infoService = (InternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance(ClusterInfoService.class);
ClusterInfoServiceUtils.setUpdateFrequency(infoService, TimeValue.timeValueMillis(200));
assertNotNull("info should not be null", ClusterInfoServiceUtils.refresh(infoService));
ClusterRerouteUtils.reroute(client()); // ensure we leverage the latest cluster info

final var telemetryPlugin = getTelemetryPlugin(internalCluster().getMasterName());
telemetryPlugin.collect();
Expand Down

0 comments on commit c32b300

Please sign in to comment.