diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java index 0afd6829674..1e9aacb5afa 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java @@ -878,7 +878,7 @@ public class AsyncBulkByScrollActionTests extends ESTestCase { new IndexResponse( shardId, index.type(), - index.id(), + index.id() == null ? "dummy_id" : index.id(), randomInt(20), randomIntBetween(1, 16), randomIntBetween(0, Integer.MAX_VALUE), diff --git a/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java b/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java index 129be6857af..544cbb02f79 100644 --- a/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java +++ b/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java @@ -41,6 +41,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Locale; +import java.util.Objects; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM; @@ -122,13 +123,13 @@ public abstract class DocWriteResponse extends ReplicationResponse implements Wr protected final Result result; public DocWriteResponse(ShardId shardId, String type, String id, long seqNo, long primaryTerm, long version, Result result) { - this.shardId = shardId; - this.type = type; - this.id = id; + this.shardId = Objects.requireNonNull(shardId); + this.type = Objects.requireNonNull(type); + this.id = Objects.requireNonNull(id); this.seqNo = seqNo; this.primaryTerm = primaryTerm; this.version = version; - this.result = result; + this.result = Objects.requireNonNull(result); } // needed for deserialization diff --git a/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java b/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java index e7f05761bf9..fc4dee1c1b2 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java @@ -101,6 +101,7 @@ public class TransportBulkAction extends HandledTransportAction {}); - TestProcessor processor2 = new TestProcessor("processor_1", "mock", - ingestDocument -> { throw new RuntimeException("processor failed"); }); + TestProcessor processor2 = new TestProcessor("processor_1", "mock", new RuntimeException("processor failed")); TestProcessor processor3 = new TestProcessor("processor_2", "mock", ingestDocument -> {}); Pipeline pipeline = new Pipeline("_id", "_description", version, new CompoundProcessor(processor1, processor2, processor3)); SimulateDocumentResult actualItemResponse = executionService.executeDocument(pipeline, ingestDocument, true); @@ -126,8 +125,7 @@ public class SimulateExecutionServiceTests extends ESTestCase { } public void testExecuteVerboseItemWithOnFailure() throws Exception { - TestProcessor processor1 = new TestProcessor("processor_0", "mock", - ingestDocument -> { throw new RuntimeException("processor failed"); }); + TestProcessor processor1 = new TestProcessor("processor_0", "mock", new RuntimeException("processor failed")); TestProcessor processor2 = new TestProcessor("processor_1", "mock", ingestDocument -> {}); TestProcessor processor3 = new TestProcessor("processor_2", "mock", ingestDocument -> {}); Pipeline pipeline = new Pipeline("_id", "_description", version, @@ -165,7 +163,7 @@ public class SimulateExecutionServiceTests extends ESTestCase { public void testExecuteVerboseItemExceptionWithIgnoreFailure() throws Exception { RuntimeException exception = new RuntimeException("processor failed"); - TestProcessor testProcessor = new TestProcessor("processor_0", "mock", ingestDocument -> { throw exception; }); + TestProcessor testProcessor = new TestProcessor("processor_0", "mock", exception); CompoundProcessor processor = new CompoundProcessor(true, Collections.singletonList(testProcessor), Collections.emptyList()); Pipeline pipeline = new Pipeline("_id", "_description", version, new CompoundProcessor(processor)); SimulateDocumentResult actualItemResponse = executionService.executeDocument(pipeline, ingestDocument, true); diff --git a/server/src/test/java/org/elasticsearch/ingest/CompoundProcessorTests.java b/server/src/test/java/org/elasticsearch/ingest/CompoundProcessorTests.java index 24e3dcd7677..575d5629b1a 100644 --- a/server/src/test/java/org/elasticsearch/ingest/CompoundProcessorTests.java +++ b/server/src/test/java/org/elasticsearch/ingest/CompoundProcessorTests.java @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; import java.util.function.LongSupplier; import static org.hamcrest.CoreMatchers.equalTo; @@ -74,7 +75,7 @@ public class CompoundProcessorTests extends ESTestCase { } public void testSingleProcessorWithException() throws Exception { - TestProcessor processor = new TestProcessor(ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor processor = new TestProcessor(new RuntimeException("error")); LongSupplier relativeTimeProvider = mock(LongSupplier.class); when(relativeTimeProvider.getAsLong()).thenReturn(0L); CompoundProcessor compoundProcessor = new CompoundProcessor(relativeTimeProvider, processor); @@ -93,7 +94,7 @@ public class CompoundProcessorTests extends ESTestCase { } public void testIgnoreFailure() throws Exception { - TestProcessor processor1 = new TestProcessor(ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor processor1 = new TestProcessor(new RuntimeException("error")); TestProcessor processor2 = new TestProcessor(ingestDocument -> {ingestDocument.setFieldValue("field", "value");}); LongSupplier relativeTimeProvider = mock(LongSupplier.class); when(relativeTimeProvider.getAsLong()).thenReturn(0L); @@ -108,7 +109,7 @@ public class CompoundProcessorTests extends ESTestCase { } public void testSingleProcessorWithOnFailureProcessor() throws Exception { - TestProcessor processor1 = new TestProcessor("id", "first", ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor processor1 = new TestProcessor("id", "first", new RuntimeException("error")); TestProcessor processor2 = new TestProcessor(ingestDocument -> { Map ingestMetadata = ingestDocument.getIngestMetadata(); assertThat(ingestMetadata.size(), equalTo(3)); @@ -130,7 +131,7 @@ public class CompoundProcessorTests extends ESTestCase { } public void testSingleProcessorWithOnFailureDropProcessor() throws Exception { - TestProcessor processor1 = new TestProcessor("id", "first", ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor processor1 = new TestProcessor("id", "first", new RuntimeException("error")); Processor processor2 = new Processor() { @Override public IngestDocument execute(IngestDocument ingestDocument) throws Exception { @@ -159,8 +160,8 @@ public class CompoundProcessorTests extends ESTestCase { } public void testSingleProcessorWithNestedFailures() throws Exception { - TestProcessor processor = new TestProcessor("id", "first", ingestDocument -> {throw new RuntimeException("error");}); - TestProcessor processorToFail = new TestProcessor("id2", "second", ingestDocument -> { + TestProcessor processor = new TestProcessor("id", "first", new RuntimeException("error")); + TestProcessor processorToFail = new TestProcessor("id2", "second", (Consumer) ingestDocument -> { Map ingestMetadata = ingestDocument.getIngestMetadata(); assertThat(ingestMetadata.size(), equalTo(3)); assertThat(ingestMetadata.get(CompoundProcessor.ON_FAILURE_MESSAGE_FIELD), equalTo("error")); @@ -189,7 +190,7 @@ public class CompoundProcessorTests extends ESTestCase { } public void testCompoundProcessorExceptionFailWithoutOnFailure() throws Exception { - TestProcessor firstProcessor = new TestProcessor("id1", "first", ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor firstProcessor = new TestProcessor("id1", "first", new RuntimeException("error")); TestProcessor secondProcessor = new TestProcessor("id3", "second", ingestDocument -> { Map ingestMetadata = ingestDocument.getIngestMetadata(); assertThat(ingestMetadata.entrySet(), hasSize(3)); @@ -212,9 +213,9 @@ public class CompoundProcessorTests extends ESTestCase { } public void testCompoundProcessorExceptionFail() throws Exception { - TestProcessor firstProcessor = new TestProcessor("id1", "first", ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor firstProcessor = new TestProcessor("id1", "first", new RuntimeException("error")); TestProcessor failProcessor = - new TestProcessor("tag_fail", "fail", ingestDocument -> {throw new RuntimeException("custom error message");}); + new TestProcessor("tag_fail", "fail", new RuntimeException("custom error message")); TestProcessor secondProcessor = new TestProcessor("id3", "second", ingestDocument -> { Map ingestMetadata = ingestDocument.getIngestMetadata(); assertThat(ingestMetadata.entrySet(), hasSize(3)); @@ -238,9 +239,9 @@ public class CompoundProcessorTests extends ESTestCase { } public void testCompoundProcessorExceptionFailInOnFailure() throws Exception { - TestProcessor firstProcessor = new TestProcessor("id1", "first", ingestDocument -> {throw new RuntimeException("error");}); + TestProcessor firstProcessor = new TestProcessor("id1", "first", new RuntimeException("error")); TestProcessor failProcessor = - new TestProcessor("tag_fail", "fail", ingestDocument -> {throw new RuntimeException("custom error message");}); + new TestProcessor("tag_fail", "fail", new RuntimeException("custom error message")); TestProcessor secondProcessor = new TestProcessor("id3", "second", ingestDocument -> { Map ingestMetadata = ingestDocument.getIngestMetadata(); assertThat(ingestMetadata.entrySet(), hasSize(3)); @@ -264,8 +265,8 @@ public class CompoundProcessorTests extends ESTestCase { } public void testBreakOnFailure() throws Exception { - TestProcessor firstProcessor = new TestProcessor("id1", "first", ingestDocument -> {throw new RuntimeException("error1");}); - TestProcessor secondProcessor = new TestProcessor("id2", "second", ingestDocument -> {throw new RuntimeException("error2");}); + TestProcessor firstProcessor = new TestProcessor("id1", "first", new RuntimeException("error1")); + TestProcessor secondProcessor = new TestProcessor("id2", "second", new RuntimeException("error2")); TestProcessor onFailureProcessor = new TestProcessor("id2", "on_failure", ingestDocument -> {}); LongSupplier relativeTimeProvider = mock(LongSupplier.class); when(relativeTimeProvider.getAsLong()).thenReturn(0L); diff --git a/server/src/test/java/org/elasticsearch/ingest/IngestClientIT.java b/server/src/test/java/org/elasticsearch/ingest/IngestClientIT.java index 6e5d862372a..2e3a23cd3be 100644 --- a/server/src/test/java/org/elasticsearch/ingest/IngestClientIT.java +++ b/server/src/test/java/org/elasticsearch/ingest/IngestClientIT.java @@ -272,4 +272,25 @@ public class IngestClientIT extends ESIntegTestCase { GetPipelineResponse response = client().admin().cluster().prepareGetPipeline("_id2").get(); assertFalse(response.isFound()); } + + public void testWithDedicatedMaster() throws Exception { + String masterOnlyNode = internalCluster().startMasterOnlyNode(); + BytesReference source = BytesReference.bytes(jsonBuilder().startObject() + .field("description", "my_pipeline") + .startArray("processors") + .startObject() + .startObject("test") + .endObject() + .endObject() + .endArray() + .endObject()); + PutPipelineRequest putPipelineRequest = new PutPipelineRequest("_id", source, XContentType.JSON); + client().admin().cluster().putPipeline(putPipelineRequest).get(); + + BulkItemResponse item = client(masterOnlyNode).prepareBulk().add( + client().prepareIndex("test", "type").setSource("field", "value2", "drop", true).setPipeline("_id")).get() + .getItems()[0]; + assertFalse(item.isFailed()); + assertEquals("auto-generated", item.getResponse().getId()); + } } diff --git a/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java b/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java index 2c047283ed1..53a5cd1d753 100644 --- a/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java +++ b/server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java @@ -101,7 +101,7 @@ public class TrackingResultProcessorTests extends ESTestCase { public void testActualCompoundProcessorWithOnFailure() throws Exception { RuntimeException exception = new RuntimeException("fail"); - TestProcessor failProcessor = new TestProcessor("fail", "test", ingestDocument -> { throw exception; }); + TestProcessor failProcessor = new TestProcessor("fail", "test", exception); TestProcessor onFailureProcessor = new TestProcessor("success", "test", ingestDocument -> {}); CompoundProcessor actualProcessor = new CompoundProcessor(false, Arrays.asList(new CompoundProcessor(false, diff --git a/test/framework/src/main/java/org/elasticsearch/ingest/IngestTestPlugin.java b/test/framework/src/main/java/org/elasticsearch/ingest/IngestTestPlugin.java index dd38a0707b4..1fe7edc7452 100644 --- a/test/framework/src/main/java/org/elasticsearch/ingest/IngestTestPlugin.java +++ b/test/framework/src/main/java/org/elasticsearch/ingest/IngestTestPlugin.java @@ -37,6 +37,10 @@ public class IngestTestPlugin extends Plugin implements IngestPlugin { if (doc.hasField("fail") && doc.getFieldValue("fail", Boolean.class)) { throw new IllegalArgumentException("test processor failed"); } + if (doc.hasField("drop") && doc.getFieldValue("drop", Boolean.class)) { + return null; + } + return doc; })); } } diff --git a/test/framework/src/main/java/org/elasticsearch/ingest/TestProcessor.java b/test/framework/src/main/java/org/elasticsearch/ingest/TestProcessor.java index a1feb3e1f73..80579831475 100644 --- a/test/framework/src/main/java/org/elasticsearch/ingest/TestProcessor.java +++ b/test/framework/src/main/java/org/elasticsearch/ingest/TestProcessor.java @@ -22,6 +22,7 @@ package org.elasticsearch.ingest; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; +import java.util.function.Function; /** * Processor used for testing, keeps track of how many times it is invoked and @@ -31,15 +32,30 @@ public class TestProcessor implements Processor { private final String type; private final String tag; - private final Consumer ingestDocumentConsumer; + private final Function ingestDocumentMapper; private final AtomicInteger invokedCounter = new AtomicInteger(); public TestProcessor(Consumer ingestDocumentConsumer) { this(null, "test-processor", ingestDocumentConsumer); } + public TestProcessor(RuntimeException e) { + this(null, "test-processor", e); + } + + public TestProcessor(String tag, String type, RuntimeException e) { + this(tag, type, (Consumer) i -> { throw e; }); + } + public TestProcessor(String tag, String type, Consumer ingestDocumentConsumer) { - this.ingestDocumentConsumer = ingestDocumentConsumer; + this(tag, type, id -> { + ingestDocumentConsumer.accept(id); + return id; + }); + } + + public TestProcessor(String tag, String type, Function ingestDocumentMapper) { + this.ingestDocumentMapper = ingestDocumentMapper; this.type = type; this.tag = tag; } @@ -47,8 +63,7 @@ public class TestProcessor implements Processor { @Override public IngestDocument execute(IngestDocument ingestDocument) throws Exception { invokedCounter.incrementAndGet(); - ingestDocumentConsumer.accept(ingestDocument); - return ingestDocument; + return ingestDocumentMapper.apply(ingestDocument); } @Override diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index fc8809b6a70..869b4313baf 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -2203,6 +2203,7 @@ public final class InternalTestCluster extends TestCluster { .put(settings) .put(Node.NODE_MASTER_SETTING.getKey(), true) .put(Node.NODE_DATA_SETTING.getKey(), false) + .put(Node.NODE_INGEST_SETTING.getKey(), false) .build(); return startNode(settings1); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersisterTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersisterTests.java index 2692ed3552d..1c771cd7f6b 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersisterTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersisterTests.java @@ -16,6 +16,7 @@ import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.client.Client; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedTimingStats; @@ -249,7 +250,7 @@ public class JobResultsPersisterTests extends ESTestCase { // Take the listener passed to client::index as 2nd argument ActionListener listener = (ActionListener) invocationOnMock.getArguments()[1]; // Handle the response on the listener - listener.onResponse(new IndexResponse(null, null, null, 0, 0, 0, false)); + listener.onResponse(new IndexResponse(new ShardId("test", "test", 0), "_doc", "test", 0, 0, 0, false)); return null; }) .when(client).index(any(), any(ActionListener.class)); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/oidc/TransportOpenIdConnectLogoutActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/oidc/TransportOpenIdConnectLogoutActionTests.java index 6278221a362..c18bcb10996 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/oidc/TransportOpenIdConnectLogoutActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/oidc/TransportOpenIdConnectLogoutActionTests.java @@ -31,6 +31,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; +import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.tasks.Task; import org.elasticsearch.test.ClusterServiceUtils; @@ -143,7 +144,7 @@ public class TransportOpenIdConnectLogoutActionTests extends OpenIdConnectTestCa ActionListener listener = (ActionListener) invocationOnMock.getArguments()[2]; indexRequests.add(indexRequest); final IndexResponse response = new IndexResponse( - indexRequest.shardId(), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); + new ShardId("test", "test", 0), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); listener.onResponse(response); return Void.TYPE; }).when(client).execute(eq(IndexAction.INSTANCE), any(IndexRequest.class), any(ActionListener.class)); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlInvalidateSessionActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlInvalidateSessionActionTests.java index c5ed4365eff..f0337a7a72b 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlInvalidateSessionActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlInvalidateSessionActionTests.java @@ -46,6 +46,7 @@ import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.TermQueryBuilder; +import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; @@ -149,7 +150,7 @@ public class TransportSamlInvalidateSessionActionTests extends SamlTestCase { IndexRequest indexRequest = (IndexRequest) request; indexRequests.add(indexRequest); final IndexResponse response = new IndexResponse( - indexRequest.shardId(), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); + new ShardId("test", "test", 0), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); listener.onResponse((Response) response); } else if (BulkAction.NAME.equals(action.name())) { assertThat(request, instanceOf(BulkRequest.class)); diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlLogoutActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlLogoutActionTests.java index 9b9dc79a29c..488f36ea4f3 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlLogoutActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/saml/TransportSamlLogoutActionTests.java @@ -38,6 +38,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; +import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.tasks.Task; import org.elasticsearch.test.ClusterServiceUtils; @@ -170,7 +171,7 @@ public class TransportSamlLogoutActionTests extends SamlTestCase { ActionListener listener = (ActionListener) invocationOnMock.getArguments()[1]; indexRequests.add(indexRequest); final IndexResponse response = new IndexResponse( - indexRequest.shardId(), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); + new ShardId("test", "test", 0), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); listener.onResponse(response); return Void.TYPE; }).when(client).index(any(IndexRequest.class), any(ActionListener.class)); @@ -179,7 +180,7 @@ public class TransportSamlLogoutActionTests extends SamlTestCase { ActionListener listener = (ActionListener) invocationOnMock.getArguments()[2]; indexRequests.add(indexRequest); final IndexResponse response = new IndexResponse( - indexRequest.shardId(), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); + new ShardId("test", "test", 0), indexRequest.type(), indexRequest.id(), 1, 1, 1, true); listener.onResponse(response); return Void.TYPE; }).when(client).execute(eq(IndexAction.INSTANCE), any(IndexRequest.class), any(ActionListener.class)); diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java index d42ddfeb2fe..b326b3aeebf 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.watcher.execution; import org.elasticsearch.Version; import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; @@ -1098,7 +1099,8 @@ public class ExecutionServiceTests extends ESTestCase { } PlainActionFuture future = PlainActionFuture.newFuture(); - future.onResponse(new UpdateResponse(null, null, null, null, 0, 0, 0, null)); + future.onResponse(new UpdateResponse(null, new ShardId("test", "test", 0), "_doc", "test", 0, 0, 0, + DocWriteResponse.Result.CREATED)); return future; }).when(client).update(any());