104 lines
3.8 KiB
Plaintext
104 lines
3.8 KiB
Plaintext
/plan:
|
|
summary: Run shadow tests with pytest-mh (builder container)
|
|
# Testing Farm automatically injects CI-built packages via artifact plugin
|
|
# For GitLab MR: brew builds are installed via --how artifact --provide brew.build:<id>
|
|
# For Packit PR: copr builds are installed automatically
|
|
# Example for local testing with a specific build:
|
|
# tmt run --all prepare --how artifact --provide brew.build:111005
|
|
|
|
provision:
|
|
how: container
|
|
image: quay.io/centos/centos:stream10
|
|
|
|
prepare:
|
|
- name: Install base dependencies
|
|
how: install
|
|
package:
|
|
- python3-pip
|
|
- git
|
|
- podman
|
|
- hostname
|
|
|
|
- name: Upgrade pip
|
|
how: shell
|
|
script:
|
|
- pip3 install --upgrade pip
|
|
|
|
- name: Clone shadow repository for tests
|
|
how: shell
|
|
script:
|
|
- git clone https://github.com/shadow-maint/shadow.git /shadow
|
|
|
|
- name: Install Python dependencies on host
|
|
how: shell
|
|
script:
|
|
- pip3 install -r /shadow/tests/system/requirements.txt
|
|
|
|
- name: Start builder container
|
|
how: shell
|
|
script:
|
|
- podman rm -f builder || true
|
|
- podman run -d --name builder quay.io/centos/centos:stream10 sleep infinity
|
|
|
|
- name: Update builder container
|
|
how: shell
|
|
script:
|
|
- podman exec builder dnf update -y
|
|
- podman exec builder dnf install -y util-linux expect
|
|
|
|
- name: Install shadow-utils into builder container from CI artifacts
|
|
how: shell
|
|
script:
|
|
- |
|
|
# Testing Farm artifact plugin installs CI-built RPMs in the HOST container
|
|
# We need to copy those RPMs to the BUILDER container for testing
|
|
|
|
echo "=== Shadow-utils version in HOST container (from CI artifacts) ==="
|
|
rpm -qa | grep shadow-utils
|
|
echo "===================================================================="
|
|
|
|
# Download the same version RPMs that are installed in host
|
|
HOST_VERSION=$(rpm -q shadow-utils --queryformat '%{VERSION}-%{RELEASE}')
|
|
echo "Downloading shadow-utils version: ${HOST_VERSION} for builder container"
|
|
|
|
# Download all shadow-utils RPMs from host's repos/cache
|
|
dnf download --destdir=/tmp shadow-utils-${HOST_VERSION} \
|
|
shadow-utils-subid-${HOST_VERSION} 2>/dev/null || true
|
|
|
|
# Copy RPMs into builder container
|
|
for rpm in /tmp/shadow-utils-*.rpm; do
|
|
if [ -f "$rpm" ]; then
|
|
podman cp "$rpm" builder:/tmp/
|
|
fi
|
|
done
|
|
|
|
# Install the RPMs in builder container
|
|
podman exec builder bash -c 'dnf install -y /tmp/shadow-utils-*.rpm 2>/dev/null || dnf install -y shadow-utils'
|
|
|
|
echo "=== Shadow-utils version in BUILDER container (running tests) ==="
|
|
podman exec builder rpm -qa | grep shadow-utils
|
|
echo "===================================================================="
|
|
|
|
- name: Create CI user to simulate cloud VM environment
|
|
how: shell
|
|
script:
|
|
- podman exec builder useradd ci
|
|
|
|
discover:
|
|
how: fmf
|
|
|
|
execute:
|
|
how: tmt
|
|
|
|
|
|
/test:
|
|
summary: Run system tests
|
|
test: |
|
|
cd /shadow/tests/system
|
|
|
|
pytest --mh-config=mhc.yaml --mh-lazy-ssh -v \
|
|
-k "not (test_chage and invalid_date) and \
|
|
not (test_useradd and set_expire_date_with_invalid_date) and \
|
|
not (test_usermod and set_expire_date_with_invalid_date)"
|
|
duration: 30m
|