Added acknowledgment timeout test to OpenCloseIndexTests

This commit is contained in:
Luca Cavanna 2013-09-18 11:48:14 +02:00
parent e84af5c8fd
commit 2d52973783
1 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
import org.elasticsearch.action.support.IgnoreIndices; import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.junit.annotations.TestLogging; import org.elasticsearch.junit.annotations.TestLogging;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.AbstractSharedClusterTest;
@ -286,6 +287,12 @@ public class OpenCloseIndexTests extends AbstractSharedClusterTest {
OpenIndexResponse openIndexResponse = client().admin().indices().prepareOpen("test1").execute().actionGet(); OpenIndexResponse openIndexResponse = client().admin().indices().prepareOpen("test1").execute().actionGet();
assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertThat(openIndexResponse.isAcknowledged(), equalTo(true));
assertIndexIsOpenedOnAllNodes("test1"); assertIndexIsOpenedOnAllNodes("test1");
//we now set the timeout to 0, which means not wait for acknowledgement from other nodes
closeIndexResponse = client().admin().indices().prepareClose("test1").setTimeout(TimeValue.timeValueMillis(0)).execute().actionGet();
assertThat(closeIndexResponse.isAcknowledged(), equalTo(false));
//the cluster state is up-to-date for sure only on the master
assertIndexIsClosed("test1");
} }
private void assertIndexIsOpened(String... indices) { private void assertIndexIsOpened(String... indices) {