upstream ci: Remove 'molecule' from tests.

This patch removes 'molecule' as a dependency for tests, by using the
scripts under `utils` to setup the environment.

By not using molecule, we have more flexibility on using either docker
or podman as the container engine, and makes it easy to reproduce the
environment on different distros, allowing for a more consistent error
reproduction off Azure.
This commit is contained in:
Rafael Guterres Jeffman
2024-06-26 14:55:53 +00:00
committed by Thomas Woerner
parent 94311f439c
commit 8515c9a48b
3 changed files with 60 additions and 60 deletions

View File

@@ -15,8 +15,8 @@ stages:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-latest
ansible_version: "-core >=2.14,<2.15"
distro: fedora-latest
ansible_version: "-core >=2.15,<2.16"
# Galaxy on Fedora
@@ -26,8 +26,8 @@ stages:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-latest
ansible_version: "-core >=2.14,<2.15"
distro: fedora-latest
ansible_version: "-core >=2.15,<2.16"
# CentOS 9 Stream
@@ -37,8 +37,8 @@ stages:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: c9s
ansible_version: "-core >=2.14,<2.15"
distro: c9s
ansible_version: "-core >=2.15,<2.16"
# CentOS 8 Stream
@@ -48,19 +48,23 @@ stages:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: c8s
ansible_version: "-core >=2.14,<2.15"
distro: c8s
ansible_version: "-core >=2.15,<2.16"
target_python: "/usr/libexec/platform-python"
# CentOS 7 cannot be used with current systemd
#
# CentOS 7
- stage: CentOS_7
dependsOn: []
jobs:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: centos-7
ansible_version: "-core >=2.14,<2.15"
#
# - stage: CentOS_7
# dependsOn: []
# jobs:
# - template: templates/fast_tests.yml
# parameters:
# build_number: $(Build.BuildNumber)
# distro: centos-7
# ansible_version: "-core >=2.15,<2.16"
# target_python: "/usr/bin/python2"
# Rawhide
@@ -70,5 +74,5 @@ stages:
- template: templates/fast_tests.yml
parameters:
build_number: $(Build.BuildNumber)
scenario: fedora-rawhide
ansible_version: "-core >=2.14,<2.15"
distro: fedora-rawhide
ansible_version: "-core >=2.15,<2.16"

View File

@@ -1,6 +1,6 @@
---
parameters:
- name: scenario
- name: distro
type: string
default: fedora-latest
- name: build_number
@@ -8,6 +8,9 @@ parameters:
- name: ansible_version
type: string
default: ""
- name: target_python
type: string
default: "/usr/bin/python3"
jobs:
- template: playbook_fast.yml
@@ -15,13 +18,14 @@ jobs:
group_number: 1
number_of_groups: 1
build_number: ${{ parameters.build_number }}
scenario: ${{ parameters.scenario }}
distro: ${{ parameters.distro }}
ansible_version: ${{ parameters.ansible_version }}
python_version: '< 3.12'
target_python: ${{ parameters.target_python }}
# - template: pytest_tests.yml
# parameters:
# build_number: ${{ parameters.build_number }}
# scenario: ${{ parameters.scenario }}
# distro: ${{ parameters.distro }}
# ansible_version: ${{ parameters.ansible_version }}
# python_version: '< 3.12'

View File

@@ -6,7 +6,7 @@ parameters:
- name: number_of_groups
type: number
default: 1
- name: scenario
- name: distro
type: string
default: fedora-latest
- name: ansible_version
@@ -17,28 +17,28 @@ parameters:
default: 3.x
- name: build_number
type: string
- name: target_python
type: string
default: "/usr/bin/python3"
jobs:
- job: Test_Group${{ parameters.group_number }}
displayName: Run playbook tests ${{ parameters.scenario }} (${{ parameters.group_number }}/${{ parameters.number_of_groups }})
displayName: Run playbook tests ${{ parameters.distro }} (${{ parameters.group_number }}/${{ parameters.number_of_groups }})
timeoutInMinutes: 360
variables:
- template: variables.yaml
- template: variables_${{ parameters.scenario }}.yaml
- template: variables_${{ parameters.distro }}.yaml
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.python_version }}'
- script: |
pip install \
"molecule-plugins[docker]" \
"requests<2.29" \
"ansible${{ parameters.ansible_version }}"
pip install "ansible${{ parameters.ansible_version }}"
retryCountOnTaskFailure: 5
displayName: Install molecule and Ansible
displayName: Install Ansible
- script: ansible-galaxy collection install community.docker ansible.posix
- script: ansible-galaxy collection install containers.podman
retryCountOnTaskFailure: 5
displayName: Install Ansible collections
@@ -47,43 +47,35 @@ jobs:
displayName: Install dependencies
- script: |
rm -rf ~/ansible
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 }}
retryCountOnTaskFailure: 5
displayName: Setup test container
env:
ANSIBLE_LIBRARY: ./molecule
. utils/set_test_modules
python3 utils/check_test_configuration.py ${{ parameters.distro }}
displayName: Check test configuration
- script: |
utils/setup_test_container.sh \
-e podman \
-a \
-m 4 \
-n "ipaserver.test.local" \
-p ${{ parameters.target_python }} \
-i ${{ parameters.distro }}-server \
${{ parameters.distro }}-test
displayName: Setup target container
- script: |
. utils/set_test_modules
python utils/check_test_configuration.py ${{ parameters.scenario }}
displayName: Check scenario test configuration
- script: |
. utils/set_test_modules
if ! pytest \
-m "playbook" \
--verbose \
--color=yes \
--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
fi
pytest -m "playbook" --verbose --color=yes --suppress-no-test-exit-code --junit-xml=TEST-results-pr-check.xml
displayName: Run playbook tests
env:
IPA_SERVER_HOST: ${{ parameters.scenario }}
RUN_TESTS_IN_DOCKER: true
ANSIBLE_ROLES_PATH: "${PWD}/roles"
ANSIBLE_LIBRARY: "${PWD}/plugins"
ANSIBLE_MODULE_UTILS: "${PWD}/plugins/module_utils"
IPA_SERVER_HOST: ${{ parameters.distro }}-test
RUN_TESTS_IN_DOCKER: podman
IPA_DISABLED_MODULES: ${{ variables.ipa_disabled_modules }}
IPA_DISABLED_TESTS: ${{ variables.ipa_disabled_tests }}
IPA_VERBOSITY: "-vvv"
IPA_PYTHON_PATH: ${{ parameters.target_python }}
- task: PublishTestResults@2
inputs: