Skip to content

Commit

Permalink
[7.x] Move junit XML out of Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson authored May 19, 2020
1 parent 9cc48b3 commit 2f8c084
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 24 deletions.
8 changes: 3 additions & 5 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
ARG PYTHON_VERSION=3.8
FROM python:${PYTHON_VERSION}

WORKDIR /code/elasticsearch-py

COPY dev-requirements.txt .
RUN python -m pip install -r dev-requirements.txt
COPY dev-requirements.txt /tmp
RUN python -m pip install -r /tmp/dev-requirements.txt

COPY . .
WORKDIR /code/elasticsearch-py
2 changes: 1 addition & 1 deletion .ci/jobs/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
- email:
recipients: infra-root+build@elastic.co
- junit:
results: "*-junit.xml"
results: "junit/*-junit.xml"
allow-empty-results: true
12 changes: 12 additions & 0 deletions .ci/jobs/elastic+elasticsearch-py+6.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- job:
name: elastic+elasticsearch-py+6.x
display-name: 'elastic / elasticsearch-py # 6.x'
description: Testing the elasticsearch-py 6.x branch.
junit_results: "junit/*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/6.x
description: the Git branch specifier to build (<branchName>, <tagName>,
<commitId>, etc.)
2 changes: 1 addition & 1 deletion .ci/jobs/elastic+elasticsearch-py+7.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: elastic+elasticsearch-py+7.x
display-name: 'elastic / elasticsearch-py # 7.x'
description: Testing the elasticsearch-py 7.x branch.
junit_results: "*-junit.xml"
junit_results: "junit/*-junit.xml"
parameters:
- string:
name: branch_specifier
Expand Down
2 changes: 1 addition & 1 deletion .ci/jobs/elastic+elasticsearch-py+master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: elastic+elasticsearch-py+master
display-name: 'elastic / elasticsearch-py # master'
description: Testing the elasticsearch-py master branch.
junit_results: "*-junit.xml"
junit_results: "junit/*-junit.xml"
parameters:
- string:
name: branch_specifier
Expand Down
2 changes: 1 addition & 1 deletion .ci/jobs/elastic+elasticsearch-py+pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: elastic+elasticsearch-py+pull-request
display-name: 'elastic / elasticsearch-py # pull-request'
description: Testing of elasticsearch-py pull requests.
junit_results: "*-junit.xml"
junit_results: "junit/*-junit.xml"
scm:
- git:
branches:
Expand Down
2 changes: 2 additions & 0 deletions .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ docker build \

echo -e "\033[1m>>>>> Run [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"

mkdir -p junit
docker run \
--network=${NETWORK_NAME} \
--env "ELASTICSEARCH_HOST=${ELASTICSEARCH_URL}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--name elasticsearch-py \
--rm \
--volume `pwd`:/code/elasticsearch-py \
elastic/elasticsearch-py \
python setup.py test
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
requests>=2, <3
nose
pytest
pytest-cov
coverage
mock
nosexcover
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ requires = python python-urllib3

[flake8]
ignore = E203, E266, E501, W503

[tool:pytest]
junit_family=legacy
28 changes: 16 additions & 12 deletions test_elasticsearch/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from os.path import dirname, join, pardir, abspath, exists
import subprocess

import nose


def fetch_es_repo():
# user is manually setting YAML dir, don't tamper with it
Expand Down Expand Up @@ -70,19 +68,25 @@ def run_all(argv=None):

# always insert coverage when running tests
if argv is None:
junit_xml = join(
abspath(dirname(dirname(__file__))), "junit", "elasticsearch-py-junit.xml"
)
argv = [
"nosetests",
"--with-xunit",
"--with-xcoverage",
"--cover-package=elasticsearch",
"--cover-erase",
"--logging-filter=elasticsearch",
"--logging-level=DEBUG",
"--verbose",
"--with-id",
"pytest",
"--cov=elasticsearch",
"--junitxml=%s" % junit_xml,
"--log-level=DEBUG",
"--cache-clear",
"-vv",
join(abspath(dirname(__file__)), "test_exceptions.py"),
]

nose.run_exit(argv=argv, defaultTest=abspath(dirname(__file__)))
exit_code = 0
try:
subprocess.check_call(argv, stdout=sys.stdout, stderr=sys.stderr)
except subprocess.CalledProcessError as e:
exit_code = e.returncode
sys.exit(exit_code)


if __name__ == "__main__":
Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
envlist = pypy,py27,py34,py35,py36,py37,py38,lint,docs
[testenv]
whitelist_externals = git
setenv =
NOSE_XUNIT_FILE = junit-{envname}.xml
commands =
python setup.py test

Expand Down

0 comments on commit 2f8c084

Please sign in to comment.