diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py index 8da2ce7..5fff16f 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -29,6 +29,8 @@ MINIMUM_NM_VERSION_CHECK = """ - NetworkManager_version.stdout is version({minimum_nm_version}, '>=') """ +EXTRA_RUN_CONDITION_PREFIX = " - " + RUN_PLAYBOOK_WITH_NM = """# SPDX-License-Identifier: BSD-3-Clause # This file was generated by ensure_provider_tests.py --- @@ -50,9 +52,10 @@ RUN_PLAYBOOK_WITH_NM = """# SPDX-License-Identifier: BSD-3-Clause - import_playbook: {test_playbook} when: - ansible_distribution_major_version != '6' -{minimum_nm_version_check}""" +{minimum_nm_version_check}{extra_run_condition}""" MINIMUM_VERSION = "minimum_version" +EXTRA_RUN_CONDITION = "extra_run_condition" NM_ONLY_TESTS = { "playbooks/tests_ethtool_features.yml": { MINIMUM_VERSION: "'1.20.0'", @@ -88,6 +91,14 @@ def create_nm_playbook(test_playbook): nm_testfile = fileroot + "_nm.yml" 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, "" + ) + if extra_run_condition: + extra_run_condition = "{}{}\n".format( + EXTRA_RUN_CONDITION_PREFIX, extra_run_condition + ) + nm_version_check = "" if minimum_nm_version: nm_version_check = MINIMUM_NM_VERSION_CHECK.format( @@ -98,6 +109,7 @@ def create_nm_playbook(test_playbook): test_playbook=test_playbook, get_nm_version=minimum_nm_version and GET_NM_VERSION or "", minimum_nm_version_check=nm_version_check, + extra_run_condition=extra_run_condition, ) return nm_testfile, nominal_nm_testfile_data