TMT: enable gating tests maintained upstream

Resolves: RHEL-80817

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2025-03-03 14:58:02 +05:30
parent f319c55a98
commit 96869d7b0e
No known key found for this signature in database
GPG Key ID: 1C1EDD7CC7C3A0DD
9 changed files with 83 additions and 92 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -79,9 +79,7 @@ or
Summary: Tests for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%if %{defined fedora}
Requires: bats
%endif
Requires: bzip2
Requires: podman
Requires: golang
@ -94,7 +92,8 @@ Requires: git-daemon
%description tests
%{summary}
This package contains system tests for %{name}
This package contains system tests for %{name}. Only intended for distro
gating tests. End user/ customer usage not supported.
%prep
%autosetup -Sgit -n %{name}-%{version}

View File

@ -1,7 +1,16 @@
# recipients: jnovy, lsm5, santiago
--- !Policy
product_versions:
- rhel-10
- fedora-*
decision_contexts:
- bodhi_update_push_stable
- bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

34
plans/main.fmf Normal file
View File

@ -0,0 +1,34 @@
discover:
how: fmf
execute:
how: tmt
prepare:
- when: distro == centos-stream or distro == rhel
how: shell
script: |
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval '%{?rhel}').noarch.rpm
dnf -y config-manager --set-enabled epel
order: 10
- when: initiator == packit
how: shell
script: |
COPR_REPO_FILE="/etc/yum.repos.d/*podman-next*.repo"
if compgen -G $COPR_REPO_FILE > /dev/null; then
sed -i -n '/^priority=/!p;$apriority=1' $COPR_REPO_FILE
fi
dnf -y upgrade --allowerasing
order: 20
provision:
how: artemis
hardware:
memory: ">= 16 GB"
cpu:
cores: ">= 4"
threads: ">=8"
disk:
- size: ">= 512 GB"

View File

@ -1,69 +0,0 @@
#!/bin/bash -e
# Log program and kernel versions
echo "Important package versions:"
(
uname -r
rpm -qa |\
egrep 'buildah|podman|conmon|containers-common|crun|runc|iptable|slirp|aardvark|netavark|containernetworking-plugins|systemd|container-selinux' |\
sort
) | sed -e 's/^/ /'
# Log environment; or at least the useful bits
echo "Environment:"
env | grep -v LS_COLORS= | sort | sed -e 's/^/ /'
export BUILDAH_BINARY=/usr/bin/buildah
export IMGTYPE_BINARY=/usr/bin/buildah-imgtype
export COPY_BINARY=/usr/bin/buildah-copy
export TUTORIAL_BINARY=/usr/bin/buildah-tutorial
###############################################################################
# BEGIN setup/teardown
# Start a registry
pre_bats_setup() {
REGISTRY_FQIN=quay.io/libpod/registry:2
AUTHDIR=/tmp/buildah-tests-auth.$$
mkdir -p $AUTHDIR
CERT=$AUTHDIR/domain.crt
if [ ! -e $CERT ]; then
openssl req -newkey rsa:4096 -nodes -sha256 \
-keyout $AUTHDIR/domain.key -x509 -days 2 \
-out $AUTHDIR/domain.crt \
-subj "/C=US/ST=Foo/L=Bar/O=Red Hat, Inc./CN=registry host certificate" \
-addext subjectAltName=DNS:localhost
fi
if [ ! -e $AUTHDIR/htpasswd ]; then
htpasswd -Bbn testuser testpassword > $AUTHDIR/htpasswd
fi
podman rm -f registry || true
podman run -d -p 5000:5000 \
--name registry \
-v $AUTHDIR:/auth:Z \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/auth/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/auth/domain.key \
$REGISTRY_FQIN
}
post_bats_teardown() {
podman rm -f registry
}
# END setup/teardown
###############################################################################
# BEGIN actual test
pre_bats_setup
bats /usr/share/buildah/test/system
rc=$?
post_bats_teardown
exit $rc

View File

@ -1,17 +0,0 @@
---
- hosts: localhost
environment:
TMPDIR: /var/tmp
roles:
- role: standard-test-basic
tags:
- classic
- container
required_packages:
- buildah
- buildah-tests
tests:
- root-test:
dir: ./
run: ./test_buildah.sh
timeout: 80m

View File

@ -1 +0,0 @@
- import_playbook: test_buildah.yml

17
tests/tmt/system.fmf Normal file
View File

@ -0,0 +1,17 @@
require:
- buildah-tests
- git-daemon
- slirp4netns
environment:
BUILDAH_BINARY: /usr/bin/buildah
IMGTYPE_BINARY: /usr/bin/buildah-imgtype
INET_BINARY: /usr/bin/buildah-inet
COPY_BINARY: /usr/bin/buildah-copy
TUTORIAL_BINARY: /usr/bin/buildah-tutorial
TMPDIR: /var/tmp
/local/root:
summary: System test
test: bash ./system.sh
duration: 60m

18
tests/tmt/system.sh Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -exo pipefail
uname -r
rpm -q \
aardvark-dns \
buildah \
buildah-tests \
conmon \
container-selinux \
containers-common \
crun \
netavark \
systemd
bats /usr/share/buildah/test/system