Browse Source

Fix test failures in ScriptScoreQueryTests (#112334)

Aurélien FOUCRET 1 year ago
parent
commit
a97b0e226e

+ 0 - 6
muted-tests.yml

@@ -151,12 +151,6 @@ tests:
 - class: org.elasticsearch.xpack.ml.integration.MlJobIT
 - class: org.elasticsearch.xpack.ml.integration.MlJobIT
   method: testDeleteJobAsync
   method: testDeleteJobAsync
   issue: https://github.com/elastic/elasticsearch/issues/112212
   issue: https://github.com/elastic/elasticsearch/issues/112212
-- class: org.elasticsearch.search.query.ScriptScoreQueryTests
-  method: testScriptTermStatsAvailable
-  issue: https://github.com/elastic/elasticsearch/issues/112278
-- class: org.elasticsearch.search.query.ScriptScoreQueryTests
-  method: testScriptTermStatsNotAvailable
-  issue: https://github.com/elastic/elasticsearch/issues/112290
 - class: org.elasticsearch.search.retriever.rankdoc.RankDocsSortBuilderTests
 - class: org.elasticsearch.search.retriever.rankdoc.RankDocsSortBuilderTests
   method: testEqualsAndHashcode
   method: testEqualsAndHashcode
   issue: https://github.com/elastic/elasticsearch/issues/112312
   issue: https://github.com/elastic/elasticsearch/issues/112312

+ 1 - 1
server/src/test/java/org/elasticsearch/search/query/ScriptScoreQueryTests.java

@@ -72,7 +72,7 @@ public class ScriptScoreQueryTests extends ESTestCase {
         w.commit();
         w.commit();
         reader = DirectoryReader.open(w);
         reader = DirectoryReader.open(w);
         searcher = newSearcher(reader);
         searcher = newSearcher(reader);
-        leafReaderContext = reader.leaves().get(0);
+        leafReaderContext = searcher.getTopReaderContext().leaves().get(0);
     }
     }
 
 
     @After
     @After