Skip to content

Commit 67d4607

Browse files
authored
Unmute SearchReplicaSelectionIT#testNodeSelection test (#132567)
1 parent 0061cd2 commit 67d4607

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,6 @@ tests:
503503
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT
504504
method: testBadAsyncId
505505
issue: https://github.com/elastic/elasticsearch/issues/132353
506-
- class: org.elasticsearch.search.routing.SearchReplicaSelectionIT
507-
method: testNodeSelection
508-
issue: https://github.com/elastic/elasticsearch/issues/132354
509506
- class: org.elasticsearch.xpack.logsdb.qa.LogsDbVersusReindexedLogsDbChallengeRestIT
510507
method: testRandomQueries
511508
issue: https://github.com/elastic/elasticsearch/issues/132376

server/src/internalClusterTest/java/org/elasticsearch/search/routing/SearchReplicaSelectionIT.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
3939
.build();
4040
}
4141

42-
public void testNodeSelection() {
42+
public void testNodeSelection() throws Exception {
4343
// We grab a client directly to avoid using a randomizing client that might set a search preference.
4444
Client client = internalCluster().coordOnlyNodeClient();
4545

@@ -76,14 +76,16 @@ public void testNodeSelection() {
7676
assertNotNull(nodeStats);
7777
assertEquals(3, nodeStats.getAdaptiveSelectionStats().getComputedStats().size());
7878

79-
assertResponse(client.prepareSearch().setQuery(matchAllQuery()), response -> {
80-
String selectedNodeId = response.getHits().getAt(0).getShard().getNodeId();
81-
double selectedRank = nodeStats.getAdaptiveSelectionStats().getRanks().get(selectedNodeId);
79+
assertBusy(() -> {
80+
assertResponse(client.prepareSearch().setQuery(matchAllQuery()), response -> {
81+
String selectedNodeId = response.getHits().getAt(0).getShard().getNodeId();
82+
double selectedRank = nodeStats.getAdaptiveSelectionStats().getRanks().get(selectedNodeId);
8283

83-
for (Map.Entry<String, Double> entry : nodeStats.getAdaptiveSelectionStats().getRanks().entrySet()) {
84-
double rank = entry.getValue();
85-
assertThat(rank, greaterThanOrEqualTo(selectedRank));
86-
}
84+
for (Map.Entry<String, Double> entry : nodeStats.getAdaptiveSelectionStats().getRanks().entrySet()) {
85+
double rank = entry.getValue();
86+
assertThat(rank, greaterThanOrEqualTo(selectedRank));
87+
}
88+
});
8789
});
8890
}
8991
}

0 commit comments

Comments
 (0)