Skip to content

Commit

Permalink
Merge pull request freeipa#1148 from rjeffman/fix_checkpr_test_selection
Browse files Browse the repository at this point in the history
upstream CI: Fix test selection for CheckPR pipeline.
  • Loading branch information
t-woerner authored Oct 20, 2023
2 parents 02223df + fe2d17e commit ba7bf0f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
20 changes: 1 addition & 19 deletions tests/azure/templates/fast_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,12 @@ jobs:
- template: playbook_fast.yml
parameters:
group_number: 1
number_of_groups: 3
number_of_groups: 1
build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}
python_version: '< 3.12'

- template: playbook_fast.yml
parameters:
group_number: 2
number_of_groups: 3
build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}
python_version: '< 3.12'

- template: playbook_fast.yml
parameters:
group_number: 3
number_of_groups: 3
build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }}
ansible_version: ${{ parameters.ansible_version }}z
python_version: '< 3.12'

# - template: pytest_tests.yml
# parameters:
# build_number: ${{ parameters.build_number }}
Expand Down
1 change: 1 addition & 0 deletions tests/azure/templates/galaxy_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
--color=yes \
--splits=${{ parameters.number_of_groups }} \
--group=${{ parameters.group_number }} \
--randomly-seed=$(date "+%Y%m%d") \
--junit-xml=TEST-results-group-${{ parameters.group_number }}.xml
displayName: Run playbook tests
env:
Expand Down
1 change: 1 addition & 0 deletions tests/azure/templates/playbook_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
--suppress-no-test-exit-code \
--splits=${{ parameters.number_of_groups }} \
--group=${{ parameters.group_number }} \
--randomly-seed=$(date "+%Y%m%d") \
--junit-xml=TEST-results-group-${{ parameters.group_number }}.xml
then
[ $? -eq 5 ] && true || false
Expand Down
1 change: 1 addition & 0 deletions tests/azure/templates/playbook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
--color=yes \
--splits=${{ parameters.number_of_groups }} \
--group=${{ parameters.group_number }} \
--randomly-seed=$(date "+%Y%m%d") \
--junit-xml=TEST-results-group-${{ parameters.group_number }}.xml
displayName: Run playbook tests
env:
Expand Down
14 changes: 10 additions & 4 deletions utils/get_test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def get_tasks(task_block):
for tasks in task_block:
for task in tasks:
original_task = task
if "." in task:
task = task.split(".")[-1]
if task == "block":
_result.update(get_tasks(tasks["block"]))
elif task in ["include_tasks", "import_tasks"
Expand Down Expand Up @@ -127,8 +125,16 @@ def parse_playbooks(test_module):
"builtins.__import__", side_effect=import_mock
):
# pylint: disable=no-value-for-parameter
loader = SourceFileLoader(playbook, source)
loader.exec_module(types.ModuleType(loader.name))
try:
loader = SourceFileLoader(playbook, source)
loader.exec_module(
types.ModuleType(loader.name)
)
except Exception: # pylint: disable=broad-except
# If import fails, we'll assume there's no
# plugin to be loaded. This is of little risk
# it is rare that a plugin includes another.
pass
# pylint: disable=no-member
candidates = [
f.split(".")[1:]
Expand Down

0 comments on commit ba7bf0f

Please sign in to comment.