From 85631c121e7e3ee8462cfedeef0857c9669e4b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Wed, 3 Jun 2026 11:00:05 +0200 Subject: [PATCH] Use osci+tmt for gating --- .fmf/version | 1 + gating.yaml | 2 +- plan.fmf | 47 ++++++++++++++++++++++++++++ tests/pip_install_upgrade/runtest.sh | 40 +++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 plan.fmf create mode 100755 tests/pip_install_upgrade/runtest.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml index 9e0ee4a..6985029 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,4 +3,4 @@ product_versions: - rhel-8 decision_context: osci_compose_gate rules: - - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} \ No newline at end of file + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..94a9115 --- /dev/null +++ b/plan.fmf @@ -0,0 +1,47 @@ +execute: + how: tmt + +discover: + - name: tests_python + how: shell + url: https://gitlab.com/redhat/centos-stream/tests/python.git + tests: + - name: smoke36 + path: /smoke + test: VERSION=3.6 TOX=false CYTHON=false ./venv.sh + - name: smoke36_virtualenv + path: /smoke + test: VERSION=3.6 METHOD=virtualenv TOX=false ./venv.sh + - name: smoke312 + path: /smoke + test: VERSION=3.12 TOX=false ./venv.sh + - name: same_repo + how: shell + tests: + - name: pip_install_upgrade + path: /tests/pip_install_upgrade/ + test: ./runtest.sh + +prepare: + - name: Enable CRB + how: feature + crb: enabled + - name: Enable EPEL + how: feature + epel: enabled + - name: Install dependencies + how: install + package: + - gcc + - virtualenv + - platform-python-devel + - python3.12-devel + - grep + - util-linux + - shadow-utils + - expect + - dnf + - name: Update packages + how: shell + script: dnf upgrade -y + diff --git a/tests/pip_install_upgrade/runtest.sh b/tests/pip_install_upgrade/runtest.sh new file mode 100755 index 0000000..f8924c4 --- /dev/null +++ b/tests/pip_install_upgrade/runtest.sh @@ -0,0 +1,40 @@ +#!/bin/sh -eux +# This script requires root privileges and you should never run it on your own machine +test $EUID -eq 0 + +PYTHON_VERSION=$(/usr/bin/python3 -c 'import sys; print("{}.{}".format(*sys.version_info))') +RPM_SITELIB="/usr/lib/python${PYTHON_VERSION}/site-packages" +LOCAL_SITELIB="/usr/local/lib/python${PYTHON_VERSION}/site-packages" +USER_SITELIB="/home/fedora-test-user/.local/lib/python${PYTHON_VERSION}/site-packages" + +# First, let's install older Pello with pip as if it was installed by RPM +# This is an approximation, but it usually works +RPM_BUILD_ROOT=/ /usr/bin/pip-${PYTHON_VERSION} install 'Pello==1.0.1' + +# Now, we'll upgrade it with regular pip +/usr/bin/pip-${PYTHON_VERSION} install --upgrade 'Pello==1.0.2' + +# pip should see it +/usr/bin/pip-${PYTHON_VERSION} freeze | grep '^Pello==1\.0\.2$' + +# Both installations should still exist +test -d "${RPM_SITELIB}/Pello-1.0.1-py${PYTHON_VERSION}.egg-info" || test -d "${RPM_SITELIB}/Pello-1.0.1.dist-info" +test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info" + +# Let's ditch the local one +/usr/bin/pip-${PYTHON_VERSION} uninstall --yes Pello + +# It should only remove one of them +test -d "${RPM_SITELIB}/Pello-1.0.1-py${PYTHON_VERSION}.egg-info" || test -d "${RPM_SITELIB}/Pello-1.0.1.dist-info" +! test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info" + +# And pip should still see the RPM-installed one +/usr/bin/pip-${PYTHON_VERSION} freeze | grep '^Pello==1\.0\.1$' + +# Again, but as regular user +useradd fedora-test-user +su fedora-test-user -c "/usr/bin/pip-${PYTHON_VERSION} install --user 'Pello==1.0.2'" +test -d "${USER_SITELIB}/Pello-1.0.2.dist-info" +su fedora-test-user -c "/usr/bin/pip-${PYTHON_VERSION} freeze" | grep '^Pello==1\.0\.2$' +su fedora-test-user -c "/usr/bin/pip-${PYTHON_VERSION} uninstall --yes Pello" +su fedora-test-user -c "/usr/bin/pip-${PYTHON_VERSION} freeze" | grep '^Pello==1\.0\.1$'