diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java b/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java index 5cc571e727b11..eaf63a90aa473 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java @@ -19,9 +19,6 @@ package org.elasticsearch.action.admin.indices.create; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.UnavailableShardsException; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; @@ -35,9 +32,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.service.ClusterApplierService; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; @@ -49,7 +44,6 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; -import org.elasticsearch.test.MockLogAppender; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; @@ -384,48 +378,4 @@ public void testIndexNameInResponse() { assertEquals("Should have index name in response", "foo", response.index()); } - - /** - * Test that when creating a new index successfully, a failure in the ActionListener's onResponse does not result in a call to - * onFailure. It is the responsibility of the caller to handle exceptions in the ActionListener's onResponse and onFailure methods. - */ - public void testOnResponseFailureOnMaster() throws Exception { - final String exceptionMessage = randomAlphaOfLength(10); - final Logger logger = LogManager.getLogger(ClusterApplierService.class); - final MockLogAppender appender = new MockLogAppender(); - appender.start(); - appender.addExpectation( - new MockLogAppender.ExceptionSeenEventExpectation( - getTestName(), - logger.getName(), - Level.WARN, - "failed to notify ClusterStateListener", - TestException.class, - exceptionMessage)); - try { - Loggers.addAppender(logger, appender); - - internalCluster().masterClient().admin().indices().prepareCreate("test").execute(new ActionListener<>() { - @Override - public void onResponse(CreateIndexResponse response) { - throw new TestException(exceptionMessage); - } - - @Override - public void onFailure(Exception e) { - fail(); - } - }); - assertBusy(appender::assertAllExpectationsMatched); - } finally { - Loggers.removeAppender(logger, appender); - appender.stop(); - } - } - - private static class TestException extends RuntimeException { - TestException(String message) { - super(message); - } - } }