5.0 compatibility
This commit is contained in:
@@ -7,6 +7,7 @@ import re
|
||||
from os import walk, environ
|
||||
from os.path import exists, join, dirname, pardir
|
||||
import yaml
|
||||
from shutil import rmtree
|
||||
|
||||
from elasticsearch import TransportError
|
||||
from elasticsearch.compat import string_types
|
||||
@@ -48,6 +49,13 @@ class YamlTestCase(ElasticsearchTestCase):
|
||||
self.last_response = None
|
||||
self._state = {}
|
||||
|
||||
def tearDown(self):
|
||||
super(YamlTestCase, self).tearDown()
|
||||
for repo, definition in self.client.snapshot.get_repository(repository='_all').items():
|
||||
self.client.snapshot.delete_repository(repository=repo)
|
||||
if definition['type'] == 'fs':
|
||||
rmtree('/tmp/%s' % definition['settings']['location'])
|
||||
|
||||
def _resolve(self, value):
|
||||
# resolve variables
|
||||
if isinstance(value, string_types) and value.startswith('$'):
|
||||
|
||||
@@ -191,7 +191,7 @@ class TestScan(ElasticsearchTestCase):
|
||||
bulk.append({"answer": x, "correct": x == 42})
|
||||
self.client.bulk(bulk, refresh=True)
|
||||
|
||||
docs = list(helpers.scan(self.client, index="test_index", doc_type="answers", size=2, query={"sort": ["answer"]}, preserve_order=True))
|
||||
docs = list(helpers.scan(self.client, index="test_index", doc_type="answers", query={"sort": "answer"}, preserve_order=True))
|
||||
|
||||
self.assertEquals(100, len(docs))
|
||||
self.assertEquals(list(map(str, range(100))), list(d['_id'] for d in docs))
|
||||
@@ -229,7 +229,7 @@ class TestReindex(ElasticsearchTestCase):
|
||||
self.assertEquals({"answer": 42, "correct": True}, self.client.get(index="prod_index", doc_type="answers", id=42)['_source'])
|
||||
|
||||
def test_reindex_accepts_a_query(self):
|
||||
helpers.reindex(self.client, "test_index", "prod_index", query={"query": {"filtered": {"filter": {"term": {"_type": "answers"}}}}})
|
||||
helpers.reindex(self.client, "test_index", "prod_index", query={"query": {"bool": {"filter": {"term": {"_type": "answers"}}}}})
|
||||
self.client.indices.refresh()
|
||||
|
||||
self.assertTrue(self.client.indices.exists("prod_index"))
|
||||
|
||||
Reference in New Issue
Block a user