Merge "Move to stestr for functional/integration tests"

This commit is contained in:
Zuul 2018-07-29 06:28:20 +00:00 committed by Gerrit Code Review
commit 1af8e3152f
7 changed files with 17 additions and 22 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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"

View File

@ -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:

View File

@ -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=$?

View File

@ -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