From a4e068c50500c1c520ef19dc1470f388cb4b4f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 19 Nov 2013 22:33:53 +0100 Subject: [PATCH] Fix the helpers tests. ES doesn't guarantee that refresh will wait for cluster state propagation and thus the type might not exist right after the index being created during the bulk load. Just check the documents instead. --- test_elasticsearch/test_server/test_helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test_elasticsearch/test_server/test_helpers.py b/test_elasticsearch/test_server/test_helpers.py index 31a2f970..30b77001 100644 --- a/test_elasticsearch/test_server/test_helpers.py +++ b/test_elasticsearch/test_server/test_helpers.py @@ -103,8 +103,7 @@ class TestReindex(ElasticTestCase): self.client.indices.refresh() self.assertTrue(self.client.indices.exists("prod_index")) - self.assertTrue(self.client.indices.exists_type("prod_index", "answers")) - self.assertTrue(self.client.indices.exists_type("prod_index", "questions")) - self.assertEquals(100, self.client.count(index='prod_index')['count']) + self.assertEquals(50, self.client.count(index='prod_index', doc_type='questions')['count']) + self.assertEquals(50, self.client.count(index='prod_index', doc_type='answers')['count']) self.assertEquals({"answer": 42, "correct": True}, self.client.get(index="prod_index", doc_type="answers", id=42)['_source'])