-
Rafael Guterres Jeffman authored
Sometimes, mostly due do differences in package versions, there are some tests that fail on a single distribution which cannot be fixed by ansible-freeipa, requiring that the offending package is fixed. To keep tests running succesfully we have options to disable the failing tests, but this changes are globally applied, meaning that, by disabling a test, it is disable in all tested distributions. This patch allows tests to be enabled or disabled for a specific distribution, by setting the configuration on the 'variable' template for the specific testing scenario.
Rafael Guterres Jeffman authoredSometimes, mostly due do differences in package versions, there are some tests that fail on a single distribution which cannot be fixed by ansible-freeipa, requiring that the offending package is fixed. To keep tests running succesfully we have options to disable the failing tests, but this changes are globally applied, meaning that, by disabling a test, it is disable in all tested distributions. This patch allows tests to be enabled or disabled for a specific distribution, by setting the configuration on the 'variable' template for the specific testing scenario.
pytest_tests.yml 1.94 KiB
---
parameters:
- name: build_number
type: string
- name: scenario
type: string
default: fedora-latest
- name: ansible_version
type: string
default: ""
- name: python_version
type: string
default: 3.x
jobs:
- job: Test_PyTests
displayName: Run pytests on ${{ parameters.scenario }}
timeoutInMinutes: 120
variables:
- template: variables.yaml
- template: variables_${{ parameters.scenario }}.yaml
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.python_version }}'
- script: |
pip install \
"molecule[docker]>=3" \
"ansible${{ parameters.ansible_version }}"
displayName: Install molecule and Ansible
- script: ansible-galaxy collection install community.docker ansible.posix
displayName: Install Ansible collections
- script: pip install -r requirements-tests.txt
displayName: Install dependencies
- script: |
mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
cp -a roles/* ~/.ansible/roles
cp -a plugins/modules/* ~/.ansible/library
cp -a plugins/module_utils/* ~/.ansible/module_utils
molecule create -s ${{ parameters.scenario }}
displayName: Setup test container
env:
ANSIBLE_LIBRARY: ./molecule
- script: |
pytest \
-m "not playbook" \
--verbose \
--color=yes \
--junit-xml=TEST-results-pytests.xml
displayName: Run tests
env:
IPA_SERVER_HOST: ${{ parameters.scenario }}
RUN_TESTS_IN_DOCKER: true
IPA_DISABLED_MODULES: ${{ variables.ipa_disabled_modules }}
IPA_DISABLED_TESTS: ${{ variables.ipa_disabled_tests }}
IPA_ENABLED_MODULES: ${{ variables.ipa_enabled_modules }}
IPA_ENABLED_TESTS: ${{ variables.ipa_enabled_tests }}
- task: PublishTestResults@2
inputs:
mergeTestResults: true
testRunTitle: PlaybookTests-Build${{ parameters.build_number }}
condition: succeededOrFailed()