Added Elasticsearch 5 backend tests

pull/3173/merge
Karl Hobley 2016-11-08 09:21:24 +00:00 zatwierdzone przez Matt Westcott
rodzic f07b032881
commit 93cc470d4b
3 zmienionych plików z 1096 dodań i 1 usunięć

Wyświetl plik

@ -19,6 +19,7 @@ def make_parser():
parser.add_argument('--postgres', action='store_true')
parser.add_argument('--elasticsearch', action='store_true')
parser.add_argument('--elasticsearch2', action='store_true')
parser.add_argument('--elasticsearch5', action='store_true')
parser.add_argument('rest', nargs='*')
return parser
@ -58,6 +59,9 @@ def runtests():
elif args.elasticsearch2:
os.environ.setdefault('ELASTICSEARCH_URL', 'http://localhost:9200')
os.environ.setdefault('ELASTICSEARCH_VERSION', '2')
elif args.elasticsearch5:
os.environ.setdefault('ELASTICSEARCH_URL', 'http://localhost:9200')
os.environ.setdefault('ELASTICSEARCH_VERSION', '5')
elif 'ELASTICSEARCH_URL' in os.environ:
# forcibly delete the ELASTICSEARCH_URL setting to skip those tests
del os.environ['ELASTICSEARCH_URL']

Wyświetl plik

@ -171,7 +171,9 @@ WAGTAILSEARCH_BACKENDS = {
AUTH_USER_MODEL = 'customuser.CustomUser'
if 'ELASTICSEARCH_URL' in os.environ:
if os.environ.get('ELASTICSEARCH_VERSION') == '2':
if os.environ.get('ELASTICSEARCH_VERSION') == '5':
backend = 'wagtail.wagtailsearch.backends.elasticsearch5'
elif os.environ.get('ELASTICSEARCH_VERSION') == '2':
backend = 'wagtail.wagtailsearch.backends.elasticsearch2'
else:
backend = 'wagtail.wagtailsearch.backends.elasticsearch'