Skip to content

Commit

Permalink
[CI] Auto commit changes from spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticsearchmachine committed Dec 19, 2024
1 parent c058226 commit e10d2fc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,7 @@ public void testDoNotInfinitelyWaitForMapping() {
internalCluster().ensureAtLeastNumDataNodes(3);
createIndex(
"test",
indexSettings(1, 0)
.put("index.analysis.analyzer.test_analyzer.type", "custom")
indexSettings(1, 0).put("index.analysis.analyzer.test_analyzer.type", "custom")
.put("index.analysis.analyzer.test_analyzer.tokenizer", "standard")
.putList("index.analysis.analyzer.test_analyzer.filter", "test_token_filter")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;
import org.elasticsearch.index.analysis.TokenFilterFactory;
import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.index.mapper.DocumentParsingException;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.indices.analysis.AnalysisModule;
import org.elasticsearch.indices.recovery.IndexRecoveryIT;
import org.elasticsearch.plugins.AnalysisPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.PluginsService;
Expand Down Expand Up @@ -98,9 +96,9 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() {
ensureStableCluster(1);

final TestTelemetryPlugin plugin = internalCluster().getInstance(PluginsService.class, dataNode)
.filterPlugins(TestTelemetryPlugin.class)
.findFirst()
.orElseThrow();
.filterPlugins(TestTelemetryPlugin.class)
.findFirst()
.orElseThrow();
plugin.resetMeter();

assertAcked(prepareCreate("index_no_refresh", Settings.builder().put("index.refresh_interval", "-1")));
Expand All @@ -117,11 +115,10 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() {
}
{
var e = expectThrows(
VersionConflictEngineException.class,
() -> client(dataNode).get(
new GetRequest(indexName, docId).version(10)
.versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE))
).actionGet()
VersionConflictEngineException.class,
() -> client(dataNode).get(
new GetRequest(indexName, docId).version(10).versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE))
).actionGet()
);
assertThat(e.getMessage(), containsString("version conflict"));
assertThat(e.status(), is(RestStatus.CONFLICT));
Expand All @@ -132,12 +129,12 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() {
client(dataNode).admin().indices().prepareRefresh(indexName).get();
{
var e = expectThrows(
VersionConflictEngineException.class,
() -> client(dataNode).get(
new GetRequest(indexName, docId).version(5)
.versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE))
.realtime(false)
).actionGet()
VersionConflictEngineException.class,
() -> client(dataNode).get(
new GetRequest(indexName, docId).version(5)
.versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE))
.realtime(false)
).actionGet()
);
assertThat(e.getMessage(), containsString("version conflict"));
assertThat(e.status(), is(RestStatus.CONFLICT));
Expand Down Expand Up @@ -186,9 +183,9 @@ public void testMetricsForIndexingVersionConflicts() {
ensureStableCluster(1);

final TestTelemetryPlugin plugin = internalCluster().getInstance(PluginsService.class, dataNode)
.filterPlugins(TestTelemetryPlugin.class)
.findFirst()
.orElseThrow();
.filterPlugins(TestTelemetryPlugin.class)
.findFirst()
.orElseThrow();
plugin.resetMeter();

assertAcked(
Expand Down Expand Up @@ -223,9 +220,9 @@ public void testMetricsForIndexingVersionConflicts() {
// if_seq_no conflict
{
var e = expectThrows(
VersionConflictEngineException.class,
() -> client(dataNode).index(new IndexRequest("test").id(docId).source(Map.of()).setIfSeqNo(1).setIfPrimaryTerm(1))
.actionGet()
VersionConflictEngineException.class,
() -> client(dataNode).index(new IndexRequest("test").id(docId).source(Map.of()).setIfSeqNo(1).setIfPrimaryTerm(1))
.actionGet()
);
assertThat(e.getMessage(), containsString("version conflict"));
assertThat(e.status(), is(RestStatus.CONFLICT));
Expand All @@ -250,10 +247,8 @@ public void testMetricsForIndexingVersionConflicts() {
{
var e = expectThrows(
MapperParsingException.class,
() -> client(dataNode).index(
new IndexRequest("test").id(docId + "other")
.source(Map.of("test_field", "this will error"))
).actionGet()
() -> client(dataNode).index(new IndexRequest("test").id(docId + "other").source(Map.of("test_field", "this will error")))
.actionGet()
);
assertThat(e.status(), is(RestStatus.BAD_REQUEST));
}
Expand All @@ -268,7 +263,6 @@ public void testMetricsForIndexingVersionConflicts() {
assertThat(measurements.get(1).attributes(), is(Map.of("es.indexing.indexing.failed.cause", "version_conflict")));
}


public static final class TestAnalysisPlugin extends Plugin implements AnalysisPlugin {
final AtomicBoolean throwParsingError = new AtomicBoolean(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down

0 comments on commit e10d2fc

Please sign in to comment.