migrate gating tests to fmf

The deprecated STI gating test definition is removed in favor of
flexible metadata format (fmf). This fixes testing in Testing Farm
which is enabled in CentOS Stream merge requests.

This is not the final version, some workarounds were needed. Most
notable ones are patching sources which is not yet supported by
tmt (test management tool - used to run tests in Testing Farm).
Tmt also does not download rubygems, so a macro was put in place
to avoid errors while trying to copy them in the prep phase of rpmbuild.

To ensure smooth build process in the future, we will test that the new
gating test definition will match the previous result without changing
the package content.

Resolves: RHEL-15218
This commit is contained in:
Michal Pospisil 2023-11-02 15:45:41 +01:00
parent 29b5c819b6
commit 515752d4a1
5 changed files with 83 additions and 67 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

54
gating.fmf Normal file
View File

@ -0,0 +1,54 @@
summary: PCS gating test plan
description: Runs upstream tier0, tier1 and smoke tests
discover:
how: shell
dist-git-source: true
tests:
# Workaround until tmt supports patching sources
- name: Patch sources and run autotools
test: ./prepare-env.sh
duration: 30m
- name: Tier 0 tests
test: ./builddir/pcs-*/pcs_test/suite --tier0 -v --vanilla --installed
duration: 10m
- name: Tier 1 tests
test: ./builddir/pcs-*/pcs_test/suite --tier1 -v --vanilla --installed
duration: 2h
- name: Smoke tests
test: |
systemctl start pcsd
./builddir/pcs-*/pcs_test/smoke.sh
duration: 10m
prepare:
- name: Install config-manager DNF plugin for enabling HA repos
how: install
package: dnf-command(config-manager)
- name: Enable HA repo
how: shell
script: dnf config-manager --set-enabled ha powertools || true
- name: Install packages
how: install
package:
- autoconf
- automake
- make
- rpm-build
- ruby-devel
- git-core
- booth-site
- fence-agents-apc
- fence-agents-ipmilan
- fence-agents-scsi
- fence-virt
- openssl
- pcs
- pcs-snmp
- python3-pip
- python3-setuptools_scm
- python3-wheel
- rubygem-json
- rubygem-test-unit
- wget
execute:
how: tmt

View File

@ -1,6 +1,6 @@
Name: pcs
Version: 0.10.17
Release: 2%{?dist}
Release: 3%{?dist}
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPL-2.0-only: pcs
@ -332,6 +332,9 @@ update_times_patch %{PATCH3}
echo "%version+$(echo "%{version_or_commit}" | head -c 8)" > %{_builddir}/%{pcs_source_name}/.tarball-version
%endif
%if 0%{?skip_bundle_prep}
echo "Skipping copying bundled dependencies."
%else
cp -f %SOURCE1 %{pcsd_public_dir}/images
# prepare dirs/files necessary for building all bundles
@ -365,6 +368,7 @@ cp -f %SOURCE42 rpm/
cp -f %SOURCE43 rpm/
cp -f %SOURCE44 rpm/
cp -f %SOURCE45 rpm/
%endif
%build
%define debug_package %{nil}
@ -580,6 +584,10 @@ remove_all_tests
%license pyagentx_LICENSE.txt
%changelog
* Wed Nov 1 2023 Michal Pospisil <mpospisi@redhat.com> - 0.10.17-3
- No changes, testing a new quality control process
- Resolves: RHEL-15218
* Thu Jul 13 2023 Michal Pospisil <mpospisi@redhat.com> - 0.10.17-2
- Make use of filters when extracting tarballs to enhance security if provided by Python (`pcs config restore` command)
- Do not display duplicate records in commands `pcs property [config] --all` and `pcs property describe`

19
prepare-env.sh Executable file
View File

@ -0,0 +1,19 @@
set -eo xtrace
# Rpmbuild expects patches in the _sourcedir
mv *.patch $TMT_SOURCE_DIR
mkdir builddir
# Workaround for tmt not downloading rubygems, there is a spec macro that skips
# copying them during prep phase
rpmbuild -bp pcs.spec --nodeps --define "_sourcedir $TMT_SOURCE_DIR" \
--define "_builddir $(pwd)/builddir" --define="skip_bundle_prep 1"
# Remove pcs-web-ui in builddir for "cd pcs-*" to have exactly one match
rm -rf builddir/pcs-web-ui-*
cd builddir/pcs-*
# Run autotools, use bundled dependencies from the system
export PYTHONPATH=/usr/lib64/pcs/pcs_bundled/packages/
export GEM_HOME=/usr/lib64/pcsd/vendor/bundle/
./autogen.sh
# Workaround until configure.ac is prepared for centos-stream-*
./configure --with-distro=rhel
# Remove pcs sources to make sure tests are not using any of those files
rm -rf pcs

View File

@ -1,66 +0,0 @@
- hosts: localhost
tags:
- classic
vars:
# standard-test-basic directory for tests are relative to {{ tenv_workdir }}
tenv_workdir: /var/test
pre_tasks:
- import_role:
name: standard-test-source
vars:
fetch_only: True
- name: Copy files including source to test environment
synchronize:
src: "{{ playbook_dir }}/.."
dest: "{{ tenv_workdir }}"
mode: push
ssh_args: "-o UserKnownHostsFile=/dev/null"
roles:
# roles documentation:
# https://pagure.io/standard-test-roles/blob/master/f/roles/standard-test-source
- role: standard-test-basic
required_packages:
- autoconf
- automake
- make
- rpm-build
- ruby-devel
- git-core
- booth-site
- fence-agents-apc
- fence-agents-ipmilan
- fence-agents-scsi
- fence-virt
- pcs
- python3-setuptools_scm
- python3-wheel
- rubygem-test-unit
- wget
required_services:
- pcsd
tests:
# dir: . -> dot means tests dir in distgit
- prepare-source:
dir: ./
run: rpmbuild -bp {{tenv_workdir}}/*.spec --nodeps --define "_sourcedir {{tenv_workdir}}" --define "_builddir {{tenv_workdir}}/source"
# pcs-web-ui sources are deleted because there are conflicts during move of sources
# pcs-web-ui sources aren't needed during testing
- flatten-source:
dir: ./
run: rm -rf {{tenv_workdir}}/source/pcs-web-ui-*; shopt -s dotglob; mv {{tenv_workdir}}/source/*/* {{tenv_workdir}}/source
- build_sources:
dir: ./source
run: "export PYTHONPATH=/usr/lib64/pcs/pcs_bundled/packages/; export GEM_HOME=/usr/lib64/pcsd/vendor/bundle/; ./autogen.sh && ./configure --enable-tests-only"
- remove_sources:
dir: ./source
run: rm -rfv pcs
- run_upstream_tier0_tests:
dir: ./source
run: pcs_test/suite --tier0 -v --vanilla --installed
- run_upstream_tier1_tests:
dir: ./source
run: pcs_test/suite --tier1 -v --vanilla --installed
- run_smoke_tests:
dir: ./source
run: pcs_test/smoke.sh