-
Rafael Guterres Jeffman authored
Currently, upstream CI test documentation against different Ansible versions, but playbook tests are only executed with Ansible 2.9 series. This patch add support for running playbook tests against Ansible 2.9, ansible-core 2.11, and against latest version of Ansible. As running all the tests for every PR would take too long, the tests for every PR use only Anisble 2.9, and are executed on Fedora-latest and CentOS 7 and 8. A new pipeline for nightly tests was added, which runs the tests in the same distros, using Ansible 2.9, latest and Ansible-core 2.11.
Rafael Guterres Jeffman authoredCurrently, upstream CI test documentation against different Ansible versions, but playbook tests are only executed with Ansible 2.9 series. This patch add support for running playbook tests against Ansible 2.9, ansible-core 2.11, and against latest version of Ansible. As running all the tests for every PR would take too long, the tests for every PR use only Anisble 2.9, and are executed on Fedora-latest and CentOS 7 and 8. A new pipeline for nightly tests was added, which runs the tests in the same distros, using Ansible 2.9, latest and Ansible-core 2.11.
pytest_tests.yml 1.57 KiB
---
parameters:
- name: build_number
type: string
- name: scenario
type: string
- name: ansible_version
type: string
default: ""
- name: python_version
type: string
default: 3.6
jobs:
- job: Test_PyTests
displayName: Run pytests on ${{ parameters.scenario }}
timeoutInMinutes: 120
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
- task: PublishTestResults@2
inputs:
mergeTestResults: true
testRunTitle: PlaybookTests-Build${{ parameters.build_number }}
condition: succeededOrFailed()