From 105d4bab5fce9414bf96933a11b7ec4ba2ca7887 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Sat, 27 Jul 2013 10:57:25 +0200 Subject: [PATCH] Updated test to reflect added acknowledgement from all nodes in open/close index api If it's acknowledged all the other nodes already hold the latest cluster state, thus we can search on the closed index and be sure we get an error back --- .../test/integration/indices/IgnoreIndicesTests.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/integration/indices/IgnoreIndicesTests.java b/src/test/java/org/elasticsearch/test/integration/indices/IgnoreIndicesTests.java index 3d243caf254..3343fa32da3 100644 --- a/src/test/java/org/elasticsearch/test/integration/indices/IgnoreIndicesTests.java +++ b/src/test/java/org/elasticsearch/test/integration/indices/IgnoreIndicesTests.java @@ -19,19 +19,16 @@ package org.elasticsearch.test.integration.indices; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; +import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.support.IgnoreIndices; import org.elasticsearch.cluster.block.ClusterBlockException; -import org.elasticsearch.common.Priority; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.integration.AbstractSharedClusterTest; import org.junit.Test; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; -import static org.junit.Assert.fail; public class IgnoreIndicesTests extends AbstractSharedClusterTest { @@ -180,8 +177,9 @@ public class IgnoreIndicesTests extends AbstractSharedClusterTest { createIndex("test1", "test2"); ensureGreen(); client().prepareSearch("test1", "test2").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); - client().admin().indices().prepareClose("test2").execute().actionGet(); - ensureGreen(); + CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test2").execute().actionGet(); + assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); + try { client().prepareSearch("test1", "test2").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); fail("Exception should have been thrown");