mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-16 22:10:28 +00:00
Added Elasticsearch 5 backend tests
This commit is contained in:
parent
f07b032881
commit
93cc470d4b
3 changed files with 1096 additions and 1 deletions
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
1089
wagtail/wagtailsearch/tests/test_elasticsearch5_backend.py
Normal file
1089
wagtail/wagtailsearch/tests/test_elasticsearch5_backend.py
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue