Fix ReloadSynonymAnalyzerIT failure (#53663)
There is an assertion in ReloadAnalyzersResponse.merge that compares index names of merged responses that was falsely using object equality instead of String.equals(). In the past this didn't seem to matter but with changes in the test setup we started to see failures. Correcting this and also simplifying test a bit to be able to run it repeatedly if needed. Closes #53443
This commit is contained in:
parent
474dfbf9c7
commit
2c32173fce
|
@ -164,7 +164,7 @@ public class ReloadAnalyzersResponse extends BroadcastResponse {
|
|||
}
|
||||
|
||||
void merge(ReloadResult other) {
|
||||
assert this.indexName == other.index;
|
||||
assert this.indexName.equals(other.index);
|
||||
this.reloadedAnalyzers.addAll(other.reloadedSearchAnalyzers);
|
||||
this.reloadedIndicesNodes.add(other.nodeId);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.core.rest.action;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.AnalyzeToken;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.Response;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
|
@ -40,7 +39,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
|||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
|
||||
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53443")
|
||||
public class ReloadSynonymAnalyzerIT extends ESIntegTestCase {
|
||||
|
||||
@Override
|
||||
|
@ -66,10 +64,8 @@ public class ReloadSynonymAnalyzerIT extends ESIntegTestCase {
|
|||
Path config = internalCluster().getInstance(Environment.class).configFile();
|
||||
String synonymsFileName = "synonyms.txt";
|
||||
Path synonymsFile = config.resolve(synonymsFileName);
|
||||
Files.createFile(synonymsFile);
|
||||
assertTrue(Files.exists(synonymsFile));
|
||||
try (PrintWriter out = new PrintWriter(
|
||||
new OutputStreamWriter(Files.newOutputStream(synonymsFile, StandardOpenOption.CREATE), StandardCharsets.UTF_8))) {
|
||||
new OutputStreamWriter(Files.newOutputStream(synonymsFile), StandardCharsets.UTF_8))) {
|
||||
out.println("foo, baz");
|
||||
}
|
||||
assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder()
|
||||
|
|
Loading…
Reference in New Issue