Move to stestr for functional/integration tests
This moves to stestr for functional/integration tests to align with preferred OpenStack test runner and also because py.test is causing issues here: [0]. [0] http://logs.openstack.org/45/573045/8/check/airship-deckhand-integration-uwsgi-py35/60bd7ae/job-output.txt.gz#_2018-06-22_03_00_51_267408 Change-Id: I701c71aef2a122b8f1fc64285cb799f71cfe520f
This commit is contained in:
parent
1583b78902
commit
29894ee854
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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:
|
||||
|
@ -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=$?
|
||||
|
||||
|
3
tox.ini
3
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
|
||||
|
Loading…
Reference in New Issue
Block a user