mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-19 09:24:41 +00:00
Support conditional testing for NM provider
- To properly run tests for features that are supported both in initscripts and NM but require a specific NM version or other condition, add a new test category for these tests. - Use the new test category to enable testing coalesce support with initscripts Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
1172c9ca85
commit
13e7f8a333
3 changed files with 35 additions and 9 deletions
|
|
@ -21,3 +21,4 @@ rules:
|
|||
ignore: |
|
||||
/tests/tests_wireless_plugin_installation_nm.yml
|
||||
/tests/tests_team_plugin_installation_nm.yml
|
||||
/tests/tests_ethtool_coalesce_initscripts.yml
|
||||
|
|
|
|||
|
|
@ -72,10 +72,6 @@ NM_ONLY_TESTS = {
|
|||
MINIMUM_VERSION: "'1.20.0'",
|
||||
"comment": "# NetworKmanager 1.20.0 added support for forgetting profiles",
|
||||
},
|
||||
"playbooks/tests_ethtool_coalesce.yml": {
|
||||
MINIMUM_VERSION: "'1.25.1'",
|
||||
"comment": "# NetworkManager 1.25.1 introduced ethtool coalesce support",
|
||||
},
|
||||
"playbooks/tests_reapply.yml": {},
|
||||
# team interface is not supported on Fedora
|
||||
"playbooks/tests_team.yml": {
|
||||
|
|
@ -89,6 +85,15 @@ NM_ONLY_TESTS = {
|
|||
},
|
||||
"playbooks/tests_wireless_plugin_installation.yml": {},
|
||||
}
|
||||
# NM_CONDITIONAL_TESTS is used to store the test playbooks which are demanding for NM
|
||||
# minimum version or extra running condition, test playbooks in NM_CONDITIONAL_TESTS
|
||||
# can also run with initscripts provider
|
||||
NM_CONDITIONAL_TESTS = {
|
||||
"playbooks/tests_ethtool_coalesce.yml": {
|
||||
MINIMUM_VERSION: "'1.25.1'",
|
||||
"comment": "# NetworkManager 1.25.1 introduced ethtool coalesce support",
|
||||
},
|
||||
}
|
||||
|
||||
IGNORE = [
|
||||
# checked by tests_regression_nm.yml
|
||||
|
|
@ -114,12 +119,19 @@ RUN_PLAYBOOK_WITH_INITSCRIPTS = """# SPDX-License-Identifier: BSD-3-Clause
|
|||
def create_nm_playbook(test_playbook):
|
||||
fileroot = os.path.splitext(os.path.basename(test_playbook))[0]
|
||||
nm_testfile = fileroot + "_nm.yml"
|
||||
if test_playbook in NM_CONDITIONAL_TESTS:
|
||||
minimum_nm_version = NM_CONDITIONAL_TESTS[test_playbook].get(MINIMUM_VERSION)
|
||||
extra_run_condition = NM_CONDITIONAL_TESTS[test_playbook].get(
|
||||
EXTRA_RUN_CONDITION, ""
|
||||
)
|
||||
comment = NM_CONDITIONAL_TESTS.get(test_playbook, {}).get("comment", "")
|
||||
else:
|
||||
minimum_nm_version = NM_ONLY_TESTS.get(test_playbook, {}).get(MINIMUM_VERSION)
|
||||
extra_run_condition = NM_ONLY_TESTS.get(test_playbook, {}).get(
|
||||
EXTRA_RUN_CONDITION, ""
|
||||
)
|
||||
comment = NM_ONLY_TESTS.get(test_playbook, {}).get("comment", "")
|
||||
|
||||
minimum_nm_version = NM_ONLY_TESTS.get(test_playbook, {}).get(MINIMUM_VERSION)
|
||||
extra_run_condition = NM_ONLY_TESTS.get(test_playbook, {}).get(
|
||||
EXTRA_RUN_CONDITION, ""
|
||||
)
|
||||
comment = NM_ONLY_TESTS.get(test_playbook, {}).get("comment", "")
|
||||
if extra_run_condition:
|
||||
extra_run_condition = f"{EXTRA_RUN_CONDITION_PREFIX}{extra_run_condition}\n"
|
||||
|
||||
|
|
|
|||
13
tests/tests_ethtool_coalesce_initscripts.yml
Normal file
13
tests/tests_ethtool_coalesce_initscripts.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# This file was generated by ensure_provider_tests.py
|
||||
---
|
||||
- hosts: all
|
||||
name: Run playbook 'playbooks/tests_ethtool_coalesce.yml' with initscripts as provider
|
||||
tasks:
|
||||
- name: Set network provider to 'initscripts'
|
||||
set_fact:
|
||||
network_provider: initscripts
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_playbook: playbooks/tests_ethtool_coalesce.yml
|
||||
Loading…
Add table
Add a link
Reference in a new issue