Skip to content

Commit

Permalink
Packit/TMT: organize test plans based on rpm dependency
Browse files Browse the repository at this point in the history
Unit and validate tests don't need to depend on the built rpm and it's
sufficient to run them on only 1 target.

So, it's more convenient to re-org the test plans based on rpm
dependency.

Signed-off-by: Lokesh Mandvekar <[email protected]>
  • Loading branch information
lsm5 committed Jan 30, 2025
1 parent fed0226 commit 3396382
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
19 changes: 17 additions & 2 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,18 @@ jobs:
project: podman-next
enable_net: true

# Unit tests on Fedora
# validate and unit tests
# rpm independent and sufficient to run on only one env
- job: tests
trigger: pull_request
packages: [aardvark-dns-fedora] # Include this else it will create multiple jobs
skip_build: true
targets:
- fedora-latest-stable
tmt_plan: "/plans/no-rpm"
identifier: "no-rpm"

# Integration tests on Fedora
- job: tests
trigger: pull_request
packages: [aardvark-dns-fedora]
Expand All @@ -103,8 +114,10 @@ jobs:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo
tmt_plan: "/plans/rpm"
identifier: "rpm-fedora"

# Unit tests on CentOS Stream
# Integration tests on CentOS Stream
- job: tests
trigger: pull_request
packages: [aardvark-dns-centos]
Expand All @@ -115,6 +128,8 @@ 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
tmt_plan: "/plans/rpm"
identifier: "rpm-centos"

# Sync to Fedora
- job: propose_downstream
Expand Down
15 changes: 6 additions & 9 deletions plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ prepare:
dnf -y upgrade --allowerasing
order: 20

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

/downstream:
summary: Run tests on bodhi / errata and dist-git PRs
/rpm:
summary: Run tests on the rpm
discover+:
filter: tag:downstream
adjust+:
- enabled: false
when: initiator == packit
filter: tag:rpm
30 changes: 14 additions & 16 deletions test/tmt/main.fmf
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# Only common dependencies that are NOT required to run netavark-tests.sh are
# specified here. Everything else is in netavark-tests.sh.
require:
- aardvark-dns-tests
- cargo
- clippy
- rustfmt

adjust:
duration: 10m
when: arch == aarch64

/validate:
tag: upstream
tag: [ no-rpm, validate ]
summary: Validate test
test: make -C ../.. validate
require:
- clippy
- rustfmt

/unit:
tag: upstream
summary: Unit test
tag: [ no-rpm, unit ]
summary: Unit tests
test: make -C ../.. unit
require:
- cargo

/integration:
tag: [ upstream, downstream]
tag: [ rpm, integration ]
summary: Integration tests
test: bash test_integration.sh
environment:
AARDVARK: /usr/libexec/podman/aardvark-dns
require:
- aardvark-dns-tests
adjust:
duration: 10m
when: arch == aarch64
2 changes: 1 addition & 1 deletion test/tmt/test_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -exo pipefail

rpm -q aardvark-dns aardvark-dns-tests netavark nftables
rpm -q aardvark-dns aardvark-dns-tests netavark

cd /usr/share/aardvark-dns/
bats test/

0 comments on commit 3396382

Please sign in to comment.