Skip test for different op types before 0.90.1
This commit is contained in:
@@ -91,6 +91,12 @@ def teardown():
|
|||||||
os.kill(int(pid), 15)
|
os.kill(int(pid), 15)
|
||||||
server.wait()
|
server.wait()
|
||||||
|
|
||||||
|
ES_VERSION = None
|
||||||
|
|
||||||
|
def _get_version(version_string):
|
||||||
|
version = version_string.strip().split('.')
|
||||||
|
return tuple(int(v) if v.isdigit() else 999 for v in version)
|
||||||
|
|
||||||
class ElasticTestCase(TestCase):
|
class ElasticTestCase(TestCase):
|
||||||
client = None
|
client = None
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -105,3 +111,11 @@ class ElasticTestCase(TestCase):
|
|||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@property
|
||||||
|
def es_version(self):
|
||||||
|
global ES_VERSION
|
||||||
|
if ES_VERSION is None:
|
||||||
|
version_string = self.client.info()['version']['number']
|
||||||
|
ES_VERSION = _get_version(version_string)
|
||||||
|
return ES_VERSION
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import yaml
|
|||||||
from elasticsearch import TransportError
|
from elasticsearch import TransportError
|
||||||
|
|
||||||
from ..test_cases import SkipTest
|
from ..test_cases import SkipTest
|
||||||
from . import ElasticTestCase
|
from . import ElasticTestCase, _get_version
|
||||||
|
|
||||||
# some params had to be changed in python, keep track of them so we can rename
|
# some params had to be changed in python, keep track of them so we can rename
|
||||||
# those in the tests accordingly
|
# those in the tests accordingly
|
||||||
@@ -19,8 +19,6 @@ PARAMS_RENAMES = {
|
|||||||
'from': 'from_',
|
'from': 'from_',
|
||||||
}
|
}
|
||||||
|
|
||||||
ES_VERSION = None
|
|
||||||
|
|
||||||
# mapping from catch values to http status codes
|
# mapping from catch values to http status codes
|
||||||
CATCH_CODES = {
|
CATCH_CODES = {
|
||||||
'missing': 404,
|
'missing': 404,
|
||||||
@@ -30,19 +28,7 @@ CATCH_CODES = {
|
|||||||
class InvalidActionType(Exception):
|
class InvalidActionType(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _get_version(version_string):
|
|
||||||
version = version_string.strip().split('.')
|
|
||||||
return tuple(int(v) if v.isdigit() else 999 for v in version)
|
|
||||||
|
|
||||||
class YamlTestCase(ElasticTestCase):
|
class YamlTestCase(ElasticTestCase):
|
||||||
@property
|
|
||||||
def es_version(self):
|
|
||||||
global ES_VERSION
|
|
||||||
if ES_VERSION is None:
|
|
||||||
version_string = self.client.info()['version']['number']
|
|
||||||
ES_VERSION = _get_version(version_string)
|
|
||||||
return ES_VERSION
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(YamlTestCase, self).setUp()
|
super(YamlTestCase, self).setUp()
|
||||||
if hasattr(self, '_setup_code'):
|
if hasattr(self, '_setup_code'):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from elasticsearch import helpers
|
from elasticsearch import helpers
|
||||||
|
|
||||||
from . import ElasticTestCase
|
from . import ElasticTestCase
|
||||||
|
from ..test_cases import SkipTest
|
||||||
|
|
||||||
class TestStreamingBulk(ElasticTestCase):
|
class TestStreamingBulk(ElasticTestCase):
|
||||||
def test_all_documents_get_inserted(self):
|
def test_all_documents_get_inserted(self):
|
||||||
@@ -29,6 +30,8 @@ class TestStreamingBulk(ElasticTestCase):
|
|||||||
assert False, "exception should have been raised"
|
assert False, "exception should have been raised"
|
||||||
|
|
||||||
def test_different_op_types(self):
|
def test_different_op_types(self):
|
||||||
|
if self.es_version < (0, 90, 1):
|
||||||
|
raise SkipTest('update supported since 0.90.1')
|
||||||
self.client.index(index='i', doc_type='t', id=45, body={})
|
self.client.index(index='i', doc_type='t', id=45, body={})
|
||||||
self.client.index(index='i', doc_type='t', id=42, body={})
|
self.client.index(index='i', doc_type='t', id=42, body={})
|
||||||
docs = [
|
docs = [
|
||||||
|
|||||||
Reference in New Issue
Block a user