Handle maxfail pytest option from InfraRed plugin
This allows to specify PyTest options depending on the workflow step For instance in the faults workflow step below option is used: --maxfail 1 The option can be forced for all speps with below InfraRed plugin option: --pytest-maxfail <N> For more details about pytest options please have a look to pytest help page: tox -e py3 -- --help Change-Id: I3146819b5f80fa4768ea38032cc8e69dc7b44f18
This commit is contained in:
parent
913a28308d
commit
ad94fe92b1
@ -191,6 +191,10 @@ subparsers:
|
|||||||
type: Value
|
type: Value
|
||||||
help: Extra options to be passed to PyTest
|
help: Extra options to be passed to PyTest
|
||||||
ansible_variable: pytest_addopts
|
ansible_variable: pytest_addopts
|
||||||
|
pytest-maxfail:
|
||||||
|
type: Value
|
||||||
|
help: Max number of test case failures before aborting
|
||||||
|
ansible_variable: pytest_maxfail
|
||||||
run-tests-timeout:
|
run-tests-timeout:
|
||||||
type: Value
|
type: Value
|
||||||
help: Timeout (in seconds) to interrupt test cases execution
|
help: Timeout (in seconds) to interrupt test cases execution
|
||||||
|
@ -4,3 +4,4 @@ test_workflow_steps:
|
|||||||
- tox_description: 'run disruptive test cases'
|
- tox_description: 'run disruptive test cases'
|
||||||
tox_envlist: instanceha
|
tox_envlist: instanceha
|
||||||
tox_step_name: instanceha
|
tox_step_name: instanceha
|
||||||
|
pytest_maxfail: 1
|
||||||
|
@ -10,6 +10,7 @@ test_workflow_steps:
|
|||||||
- tox_description: 'run disruptive test cases'
|
- tox_description: 'run disruptive test cases'
|
||||||
tox_envlist: neutron_faults
|
tox_envlist: neutron_faults
|
||||||
tox_step_name: neutron_faults
|
tox_step_name: neutron_faults
|
||||||
|
pytest_maxfail: 1
|
||||||
|
|
||||||
- tox_description: 'verify Neutron resources'
|
- tox_description: 'verify Neutron resources'
|
||||||
tox_envlist: neutron
|
tox_envlist: neutron
|
||||||
|
@ -18,6 +18,7 @@ test_workflow_steps:
|
|||||||
tox_step_name: faults
|
tox_step_name: faults
|
||||||
tox_environment:
|
tox_environment:
|
||||||
TOBIKO_PREVENT_CREATE: no
|
TOBIKO_PREVENT_CREATE: no
|
||||||
|
pytest_maxfail: 1
|
||||||
|
|
||||||
- tox_description: 'run sanity test cases after disruptive test cases'
|
- tox_description: 'run sanity test cases after disruptive test cases'
|
||||||
tox_envlist: sanity
|
tox_envlist: sanity
|
||||||
|
@ -20,8 +20,10 @@ tox_run_tests_timeout: 18000 # 5 hours
|
|||||||
tox_constraints: ''
|
tox_constraints: ''
|
||||||
|
|
||||||
tox_constrain_env:
|
tox_constrain_env:
|
||||||
PYTEST_ADDOPTS:
|
PYTEST_ADDOPTS: >
|
||||||
"{% if not test_flaky %}-m 'not flaky' {% endif %}{{ pytest_addopts }}"
|
{% if not test_flaky%}-m 'not flaky'{% endif %}
|
||||||
|
{% if pytest_maxfail %}--maxfail '{{ pytest_maxfail }}'{% endif %}
|
||||||
|
{{ pytest_addopts }}
|
||||||
TOX_REPORT_DIR: '{{ tox_report_dir }}'
|
TOX_REPORT_DIR: '{{ tox_report_dir }}'
|
||||||
TOX_REPORT_NAME: '{{ tox_report_name }}'
|
TOX_REPORT_NAME: '{{ tox_report_name }}'
|
||||||
TOX_CONSTRAINTS: '{{ tox_constraints }}'
|
TOX_CONSTRAINTS: '{{ tox_constraints }}'
|
||||||
@ -35,4 +37,5 @@ tox_expected_rcs:
|
|||||||
ignore_test_failures: no
|
ignore_test_failures: no
|
||||||
|
|
||||||
pytest_addopts: ''
|
pytest_addopts: ''
|
||||||
|
pytest_maxfail: ''
|
||||||
test_flaky: false
|
test_flaky: false
|
||||||
|
@ -13,9 +13,17 @@
|
|||||||
tox_command_line: '{{ tox_command_line.split() | join(" ") }}'
|
tox_command_line: '{{ tox_command_line.split() | join(" ") }}'
|
||||||
|
|
||||||
|
|
||||||
- name: combine environment variables
|
- name: combine and normalize environment variable values
|
||||||
set_fact:
|
set_fact:
|
||||||
tox_env: '{{ tox_environment | from_yaml | combine(tox_constrain_env) }}'
|
tox_env: >
|
||||||
|
{{ tox_env |
|
||||||
|
default({}) |
|
||||||
|
combine({ item.key: (item.value | string).strip() }) }}
|
||||||
|
loop: >
|
||||||
|
{{ ((tox_environment | from_yaml | dict2items) +
|
||||||
|
(tox_constrain_env | dict2items)) }}
|
||||||
|
when:
|
||||||
|
- (item.value | string).strip() # skip empty strings
|
||||||
|
|
||||||
- name: show tox variables
|
- name: show tox variables
|
||||||
debug: var="{{ item }}"
|
debug: var="{{ item }}"
|
||||||
|
1
tox.ini
1
tox.ini
@ -242,7 +242,6 @@ setenv =
|
|||||||
OS_TEST_PATH = {toxinidir}/tobiko/tests/faults
|
OS_TEST_PATH = {toxinidir}/tobiko/tests/faults
|
||||||
TOX_NUM_PROCESSES = 1
|
TOX_NUM_PROCESSES = 1
|
||||||
PYTEST_TIMEOUT = 3600
|
PYTEST_TIMEOUT = 3600
|
||||||
RUN_TESTS_EXTRA_ARGS = --maxfail=1 {env:OS_TEST_PATH}
|
|
||||||
|
|
||||||
|
|
||||||
[testenv:octavia_faults]
|
[testenv:octavia_faults]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user