diff --git a/deckhand/tests/common/test_gabbi.py b/deckhand/tests/common/test_gabbi.py index e1164206..d795f39e 100644 --- a/deckhand/tests/common/test_gabbi.py +++ b/deckhand/tests/common/test_gabbi.py @@ -21,7 +21,6 @@ import tempfile import yaml from gabbi import driver -from gabbi.driver import test_pytest # noqa from gabbi.handlers import jsonhandler TEST_DIR = None @@ -93,19 +92,18 @@ class MultidocJsonpaths(jsonhandler.JSONHandler): return list(yaml.load_all(string)) -def pytest_generate_tests(metafunc): - # NOTE(fmontei): While only `url` or `host` is needed, strangely both - # are needed because we use `pytest-html` which throws an error without - # `host`. +def load_tests(loader, tests, pattern): + """Provide a TestSuite to the discovery process.""" global TEST_DIR - driver.py_test_generator( + return driver.build_tests( TEST_DIR, - url=os.environ.get('DECKHAND_TEST_URL', '127.0.0.1:9000'), + loader, host='localhost', + url=os.environ.get('DECKHAND_TEST_URL', '127.0.0.1:9000'), # NOTE(fmontei): When there are multiple handlers listed that accept # the same content-type, the one that is earliest in the list will be # used. Thus, we cannot specify multiple content handlers for handling # list/dictionary responses from the server using different handlers. content_handlers=[MultidocJsonpaths], - metafunc=metafunc) + verbose=True) diff --git a/deckhand/tests/functional/gabbits/layering/layering-with-substitution-single-bucket.yaml b/deckhand/tests/functional/gabbits/layering/layering-with-substitution-single-bucket.yaml index 093d015b..927f9e89 100644 --- a/deckhand/tests/functional/gabbits/layering/layering-with-substitution-single-bucket.yaml +++ b/deckhand/tests/functional/gabbits/layering/layering-with-substitution-single-bucket.yaml @@ -214,7 +214,7 @@ tests: status: 200 data: <@resources/layering-and-substitution-sample.yaml - - name: verify_multiple_empty_top_layers + - name: verify_multiple_empty_interspersed_layers desc: Check for expected substitutions GET: /api/v1.0/revisions/$RESPONSE['$.[0].status.revision']/rendered-documents query_parameters: diff --git a/tools/functional-tests.sh b/tools/functional-tests.sh index 3d44577e..af026ead 100755 --- a/tools/functional-tests.sh +++ b/tools/functional-tests.sh @@ -57,9 +57,9 @@ export DECKHAND_TEST_DIR=${CURRENT_DIR}/deckhand/tests/functional/gabbits set +e posargs=$@ if [ ${#posargs} -ge 1 ]; then - py.test -k $1 -svx ${CURRENT_DIR}/deckhand/tests/common/test_gabbi.py + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color $1 else - py.test -svx ${CURRENT_DIR}/deckhand/tests/common/test_gabbi.py + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color fi TEST_STATUS=$? set -e diff --git a/tools/gate/roles/run-functional-tests/tasks/functional-tests.yaml b/tools/gate/roles/run-functional-tests/tasks/functional-tests.yaml index 45ef6e1a..500a2e87 100644 --- a/tools/gate/roles/run-functional-tests/tasks/functional-tests.yaml +++ b/tools/gate/roles/run-functional-tests/tasks/functional-tests.yaml @@ -22,4 +22,4 @@ DECKHAND_TEST_URL: "127.0.0.1:9000" DECKHAND_TEST_DIR: "{{ airship_deckhand_path.stdout }}/deckhand/tests/functional/gabbits" register: result - failed_when: "'commands failed' in result.stdout" + failed_when: "result.rc != 0" diff --git a/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml b/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml index d40b0bab..3a62e615 100644 --- a/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml +++ b/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml @@ -15,10 +15,9 @@ - name: Install pip3 and gabbi shell: | set -xe; - apt-get install -y python3-pip - pip3 install --upgrade pip - # Includes required requirements for testing. - pip3 install -r test-requirements.txt + apt-get install -y python-pip + pip install --upgrade pip + pip install -r test-requirements.txt args: chdir: "{{ zuul.project.src_dir }}" become: yes @@ -39,8 +38,7 @@ - name: Run Integration Tests shell: | set -ex; - py.test -svx "{{ airship_deckhand_path.stdout }}"/deckhand/tests/common/test_gabbi.py \ - && echo "Done SUCCESS" || echo "Done FAILURE" + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color args: chdir: "{{ zuul.project.src_dir }}" environment: diff --git a/tools/integration-tests.sh b/tools/integration-tests.sh index d18d0931..251b3d67 100755 --- a/tools/integration-tests.sh +++ b/tools/integration-tests.sh @@ -133,9 +133,9 @@ function run_tests { posargs=$@ if [ ${#posargs} -ge 1 ]; then - py.test -k $1 -svx ${CURRENT_DIR}/deckhand/tests/common/test_gabbi.py + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color $1 else - py.test -svx ${CURRENT_DIR}/deckhand/tests/common/test_gabbi.py + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color fi TEST_STATUS=$? diff --git a/tox.ini b/tox.ini index 6dd700b3..90c62bfa 100644 --- a/tox.ini +++ b/tox.ini @@ -53,8 +53,7 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = find . -type f -name "*.pyc" -delete - # TODO(felipemonteiro): Use OpenStack test runner. - py.test -svx {toxinidir}/deckhand/tests/common/test_gabbi.py -k '{posargs}' + stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color '{posargs}' [testenv:functional-dev] basepython=python3