diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c2fc48..71bc52b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,14 @@ jobs: - name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and elasticsearch-dsl-py ${{ matrix.es-dsl-version }} run: | TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-es${{ matrix.es-dsl-version }}" | tr -d .) - python -m tox -e $TOX_ENV -- --elasticsearch --elasticsearch-username --elasticsearch-password + python -m tox -e $TOX_ENV -- --elasticsearch + if: matrix.es-version == '7.13.4' + + - name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and elasticsearch-dsl-py ${{ matrix.es-dsl-version }} + run: | + TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-es${{ matrix.es-dsl-version }}" | tr -d .) + python -m tox -e $TOX_ENV -- --elasticsearch https://localhost:9200 --elasticsearch-username elastic --elasticsearch-password changeme + if: matrix.es-version == '8.2.0' - name: Publish Coverage Report uses: codecov/codecov-action@v1 diff --git a/runtests.py b/runtests.py index f52deb1..9369acf 100644 --- a/runtests.py +++ b/runtests.py @@ -10,23 +10,25 @@ def get_settings(): elasticsearch_dsl_default_settings = { 'hosts': os.environ.get( 'ELASTICSEARCH_URL', - 'https://127.0.0.1:9200' + '127.0.0.1:9200' ), - 'http_auth': ( + } + + if os.environ.get('ELASTICSEARCH_USERNAME') or os.environ.get('ELASTICSEARCH_PASSWORD'): + elasticsearch_dsl_default_settings['http_auth'] = ( os.environ.get('ELASTICSEARCH_USERNAME'), os.environ.get('ELASTICSEARCH_PASSWORD') ) - } - elasticsearch_certs_path = os.environ.get( - 'ELASTICSEARCH_CERTS_PATH' - ) - if elasticsearch_certs_path: - elasticsearch_dsl_default_settings['ca_certs'] = ( - elasticsearch_certs_path + elasticsearch_certs_path = os.environ.get( + 'ELASTICSEARCH_CERTS_PATH' ) - else: - elasticsearch_dsl_default_settings['verify_certs'] = False + if elasticsearch_certs_path: + elasticsearch_dsl_default_settings['ca_certs'] = ( + elasticsearch_certs_path + ) + else: + elasticsearch_dsl_default_settings['verify_certs'] = False settings.configure( DEBUG=True, @@ -73,22 +75,20 @@ def make_parser(): parser.add_argument( '--elasticsearch', nargs='?', - metavar='https://127.0.0.1:9200', - const='https://127.0.0.1:9200', + metavar='localhost:9200', + const='localhost:9200', help="To run integration test against an Elasticsearch server", ) parser.add_argument( '--elasticsearch-username', nargs='?', - metavar='elastic', - const='elastic', + default="", help="Username for Elasticsearch user" ) parser.add_argument( '--elasticsearch-password', nargs='?', - metavar='changeme', - const='changeme', + default="", help="Password for Elasticsearch user" ) parser.add_argument( diff --git a/setup.py b/setup.py index 4636c31..af28912 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ ], include_package_data=True, install_requires=[ - 'elasticsearch-dsl>=8.9.0,<9.0.0', + 'elasticsearch-dsl>=7.4.0,<9.0.0', 'six', ], license="Apache Software License 2.0", diff --git a/tox.ini b/tox.ini index 2e0f1cf..6770eb6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - {py36,py37,py38,py39,py310,py311}-django-{111,20,21,22,30,31,32,40,41}-{es64,es74,es89} + {py36,py37,py38,py39,py310,py311}-django-{111,20,21,22,30,31,32,40,41}-{es64,es74} {py37,py38,py39,py310,py311}-django-{111,20,21,22,30,31,32,40,41}-{es89} [testenv]