Skip to content

Commit

Permalink
ci: rm scheme from es url if not v8
Browse files Browse the repository at this point in the history
  • Loading branch information
tevariou committed Sep 28, 2023
1 parent 5078655 commit c2de17f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 17 additions & 17 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit c2de17f

Please sign in to comment.