From 4d5870807acf7a561062e733dc7cb4fe11a15f72 Mon Sep 17 00:00:00 2001 From: javanna Date: Thu, 6 Mar 2014 12:17:57 +0100 Subject: [PATCH] [TEST] removed explicit index deletion from AnalyzeActionTests, more ensureGreen --- .../indices/analyze/AnalyzeActionTests.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java b/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java index 35194e43e49..cdd15cf2e8f 100644 --- a/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java +++ b/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java @@ -22,7 +22,6 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequestBuilder; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; -import org.elasticsearch.common.Priority; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -40,14 +39,8 @@ public class AnalyzeActionTests extends ElasticsearchIntegrationTest { @Test public void simpleAnalyzerTests() throws Exception { - try { - client().admin().indices().prepareDelete("test").execute().actionGet(); - } catch (Exception e) { - // ignore - } - createIndex("test"); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + ensureGreen(); for (int i = 0; i < 10; i++) { AnalyzeResponse analyzeResponse = client().admin().indices().prepareAnalyze("test", "this is a test").execute().actionGet(); @@ -73,14 +66,9 @@ public class AnalyzeActionTests extends ElasticsearchIntegrationTest { @Test public void analyzeNumericField() throws ElasticsearchException, IOException { - try { - client().admin().indices().prepareDelete("test").execute().actionGet(); - } catch (Exception e) { - // ignore - } createIndex("test"); - - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + ensureGreen(); + client().prepareIndex("test", "test", "1") .setSource(XContentFactory.jsonBuilder() .startObject() @@ -157,7 +145,7 @@ public class AnalyzeActionTests extends ElasticsearchIntegrationTest { public void analyzerWithFieldOrTypeTests() throws Exception { createIndex("test"); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); + ensureGreen(); client().admin().indices().preparePutMapping("test") .setType("document").setSource(