From 3a9c2bd63969a390aa682f8305559aeefbded53c Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Wed, 13 May 2015 18:05:32 +0200 Subject: [PATCH] fix test --- .../java/org/elasticsearch/indices/SealTests.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/indices/SealTests.java b/src/test/java/org/elasticsearch/indices/SealTests.java index 346ed599635..7da9a15da35 100644 --- a/src/test/java/org/elasticsearch/indices/SealTests.java +++ b/src/test/java/org/elasticsearch/indices/SealTests.java @@ -19,20 +19,28 @@ package org.elasticsearch.indices; import org.elasticsearch.action.admin.indices.seal.SealIndicesResponse; +import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; +import static java.lang.Thread.sleep; import static org.hamcrest.Matchers.equalTo; -@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numDataNodes = 1) +@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0) public class SealTests extends ElasticsearchIntegrationTest { @Test public void testUnallocatedShardsDoesNotHang() throws InterruptedException { - // create an index but because no data nodes are available no shards will be allocated + ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder() + .put("node.data", false) + .put("node.master", true) + .put("path.data", createTempDir().toString()); + internalCluster().startNode(settingsBuilder.build()); + // create an index but because no data nodes are available no shards will be allocated createIndex("test"); // this should not hang but instead immediately return with empty result set SealIndicesResponse sealIndicesResponse = client().admin().indices().prepareSealIndices("test").get(); + // just to make sure the test actually tests the right thing assertThat(sealIndicesResponse.results().size(), equalTo(0)); } }