Skip to content

Commit 906de15

Browse files
ywangdalexey-ivanov-es
authored andcommitted
[Test] Ensure latest cluster info is used in tests (elastic#116908)
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: elastic#116870
1 parent 640af6b commit 906de15

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@ tests:
240240
- class: org.elasticsearch.index.mapper.vectors.MultiDenseVectorScriptDocValuesTests
241241
method: testFloatGetVectorValueAndGetMagnitude
242242
issue: https://github.com/elastic/elasticsearch/issues/116863
243-
- class: org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceReconcilerMetricsIT
244-
method: testDesiredBalanceMetrics
245-
issue: https://github.com/elastic/elasticsearch/issues/116870
246243
- class: org.elasticsearch.xpack.inference.InferenceRestIT
247244
method: test {p0=inference/30_semantic_text_inference/Calculates embeddings using the default ELSER 2 endpoint}
248245
issue: https://github.com/elastic/elasticsearch/issues/116542

server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconcilerMetricsIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

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

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

7274
final var telemetryPlugin = getTelemetryPlugin(internalCluster().getMasterName());
7375
telemetryPlugin.collect();

0 commit comments

Comments
 (0)