Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[skip-ci] RPM/TMT: use tests subpackage #557

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ files_to_sync:
- src: plans/
dest: plans/
delete: true
mkpath: true
- src: test/tmt
dest: test/tmt
delete: true
mkpath: true
- src: .fmf/
dest: .fmf/
delete: true
Expand Down Expand Up @@ -43,7 +48,7 @@ jobs:
notifications: &copr_build_failure_notification
failure_comment:
message: "Ephemeral COPR build failed. @containers/packit-build please check."
targets:
targets: &fedora_copr_targets
- fedora-all-x86_64
- fedora-all-aarch64
enable_net: true
Expand Down Expand Up @@ -92,15 +97,7 @@ jobs:
notifications: &test_failure_notification
failure_comment:
message: "Tests failed. @containers/packit-build please check."
targets:
- fedora-development-x86_64
- fedora-development-aarch64
- fedora-latest-x86_64
- fedora-latest-aarch64
- fedora-latest-stable-x86_64
- fedora-latest-stable-aarch64
- fedora-40-x86_64
- fedora-40-aarch64
targets: *fedora_copr_targets
tf_extra_params:
environments:
- artifacts:
Expand All @@ -118,8 +115,6 @@ jobs:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/centos-stream-$releasever/rhcontainerbot-podman-next-centos-stream-$releasever.repo
- type: repository-file
id: https://src.fedoraproject.org/rpms/epel-release/raw/epel$releasever/f/epel.repo

# Sync to Fedora
- job: propose_downstream
Expand Down
31 changes: 24 additions & 7 deletions plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,39 @@ discover:
how: fmf
execute:
how: tmt
adjust:
- when: initiator == packit
because: "We need to test with updated packages from rhcontainerbot/podman-next copr"
prepare+:
how: shell
script: |
sed -i -n '/^priority=/!p;$apriority=1' /etc/yum.repos.d/*podman-next*.repo
dnf -y upgrade --allowerasing
# FIXME: Use epel10 once bats is available there
- when: distro == centos-stream-10 or distro == rhel-10
because: "bats isn't yet available on epel10"
prepare+:
how: install
copr: rhcontainerbot/bats-el10
package: bats
- when: distro == centos-stream-9 or distro == rhel-9
because: "bats is present on EPEL on rhel9 / c9s"
prepare+:
how: feature
epel: enabled

/upstream:
summary: Run tests on upstream PRs
discover+:
filter: tag:upstream
adjust+:
enabled: false
when: initiator is not defined or initiator != packit
- enabled: false
when: initiator is not defined or initiator != packit

/downstream:
summary: Run tests on bodhi / errata and dist-git PRs
discover+:
filter: tag:downstream
dist-git-install-builddeps: true
dist-git-source: true
dist-git-remove-fmf-root: true
adjust+:
enabled: false
when: initiator == packit
- enabled: false
when: initiator == packit
38 changes: 38 additions & 0 deletions rpm/aardvark-dns.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
%global debug_package %{nil}
%endif

# Adjust/Remove after epel10 gets bats
# Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2329315
%if %{defined fedora} || %{defined rhel} && 0%{?rhel} == 9
%define bats_ofc 1
%endif

Name: aardvark-dns
%if %{defined copr_username}
Epoch: 102
Expand Down Expand Up @@ -53,6 +59,31 @@ BuildRequires: rust-srpm-macros
Forwards other request to configured resolvers.
Read more about configuration in `src/backend/mod.rs`.

# Only intended to be used for gating tests
# End user usecases not supported
Comment on lines +62 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be part of the description? So end user have actually a chance to read it.

%package tests
Summary: Tests for %{name}

Requires: %{name} = %{epoch}:%{version}-%{release}
%if %{defined bats_ofc}
Requires: bats
%else
Recommends: bats
%endif
Requires: bind-utils
Requires: iptables
Requires: jq
Requires: make
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make doesn't seem to be needed to run as your script just calls bats test/

Requires: netavark
Requires: nftables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't nftables already required by netavark?

Requires: nmap-ncat
Requires: dnsmasq

%description tests
%{summary}

This package contains system tests for %{name}

%prep
%autosetup -Sgit %{name}-%{version}
# Following steps are only required on environments like koji which have no
Expand All @@ -78,6 +109,10 @@ tar fx %{SOURCE1}
%install
%{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install

%{__install} -d -p %{buildroot}%{_datadir}/%{name}/test
%{__cp} -rp test/* %{buildroot}%{_datadir}/%{name}/test/
%{__rm} -rf %{buildroot}%{_datadir}/%{name}/test/tmt/

%files
%license LICENSE
%if (0%{?fedora} || 0%{?rhel} >= 10) && !%{defined copr_username}
Expand All @@ -87,5 +122,8 @@ tar fx %{SOURCE1}
%dir %{_libexecdir}/podman
%{_libexecdir}/podman/%{name}

%files tests
%{_datadir}/%{name}/test

%changelog
%autochangelog
8 changes: 6 additions & 2 deletions rpm/gating.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
decision_context:
- 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: []
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
13 changes: 3 additions & 10 deletions test/tmt/main.fmf
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
# Only common dependencies that are NOT required to run netavark-tests.sh are
# specified here. Everything else is in netavark-tests.sh.
require:
- bats
- bind-utils
- aardvark-dns-tests
- cargo
- clippy
- go-md2man
- iptables
- jq
- make
- netavark
- nftables
- nmap-ncat
- rustfmt
- dnsmasq

adjust:
duration: 10m
Expand All @@ -33,3 +24,5 @@ adjust:
tag: [ upstream, downstream]
summary: Integration tests
test: bash test_integration.sh
environment:
AARDVARK: /usr/libexec/podman/aardvark-dns
15 changes: 3 additions & 12 deletions test/tmt/test_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@

set -exo pipefail

# Remove testing-farm repos if they exist because they interfere with the
# podman-next copr. The default distro repos will not be removed and can be
# used wherever relevant.
rm -f /etc/yum.repos.d/tag-repository.repo
rpm -q aardvark-dns aardvark-dns-tests netavark nftables

# We want the netavark build from podman-next, so we update it after removing
# testing-farm repo.
dnf -y update netavark

rpm -q aardvark-dns cargo netavark nftables

# Run tests
make -C ../.. AARDVARK=/usr/libexec/podman/aardvark-dns integration
cd /usr/share/aardvark-dns/
bats test/