Skip to content

Commit bf12328

Browse files
committed
TMT: add more tests
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
1 parent d2a1740 commit bf12328

8 files changed

Lines changed: 191 additions & 68 deletions

File tree

.packit.yaml

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
- job: copr_build
3333
trigger: pull_request
3434
packages: [skopeo-fedora]
35-
notifications: &copr_build_failure_notification
35+
notifications: &packit_failure_notification
3636
failure_comment:
37-
message: "Ephemeral COPR build failed. @containers/packit-build please check."
37+
message: "Packit jobs failed. @containers/packit-build please check."
3838
targets: &fedora_copr_targets
3939
- fedora-all-x86_64
4040
- fedora-all-aarch64
@@ -46,8 +46,9 @@ jobs:
4646
- job: copr_build
4747
trigger: pull_request
4848
packages: [skopeo-eln]
49-
notifications: *copr_build_failure_notification
49+
notifications: *packit_failure_notification
5050
targets: &eln_copr_targets
51+
targets:
5152
fedora-eln-x86_64:
5253
additional_repos:
5354
- "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/"
@@ -59,7 +60,7 @@ jobs:
5960
- job: copr_build
6061
trigger: pull_request
6162
packages: [skopeo-centos]
62-
notifications: *copr_build_failure_notification
63+
notifications: *packit_failure_notification
6364
targets: &centos_copr_targets
6465
- centos-stream-9-x86_64
6566
- centos-stream-9-aarch64
@@ -71,51 +72,36 @@ jobs:
7172
- job: copr_build
7273
trigger: commit
7374
packages: [skopeo-fedora]
74-
notifications:
75-
failure_comment:
76-
message: "podman-next COPR build failed. @containers/packit-build please check."
7775
branch: main
7876
owner: rhcontainerbot
7977
project: podman-next
8078
enable_net: true
8179

82-
# Tests on Fedora for main branch
80+
# System tests on Fedora
8381
- job: tests
8482
trigger: pull_request
8583
packages: [skopeo-fedora]
86-
notifications: &test_failure_notification
87-
failure_comment:
88-
message: "Tests failed. @containers/packit-build please check."
84+
notifications: *packit_failure_notification
8985
targets: *fedora_copr_targets
90-
tf_extra_params:
86+
tf_extra_params: &extra_dnf_repos
9187
environments:
9288
- artifacts:
9389
- type: repository-file
9490
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo
91+
tmt_plan: "/plans/rpm/system"
92+
identifier: "system"
9593

96-
# Tests on ELN for main branch
97-
- job: tests
98-
trigger: pull_request
99-
packages: [skopeo-eln]
100-
notifications: *test_failure_notification
101-
targets: *eln_copr_targets
102-
tf_extra_params:
103-
environments:
104-
- artifacts:
105-
- type: repository-file
106-
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-eln/rhcontainerbot-podman-next-fedora-eln.repo
107-
108-
# Tests on CentOS Stream for main branch
94+
# Integration tests on Fedora
10995
- job: tests
11096
trigger: pull_request
111-
packages: [skopeo-centos]
112-
notifications: *test_failure_notification
113-
targets: *centos_copr_targets
114-
tf_extra_params:
115-
environments:
116-
- artifacts:
117-
- type: repository-file
118-
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/centos-stream-$releasever/rhcontainerbot-podman-next-centos-stream-$releasever.repo
97+
skip_build: true
98+
packages: [skopeo-fedora]
99+
notifications: *packit_failure_notification
100+
targets:
101+
- fedora-rawhide
102+
tf_extra_params: *extra_dnf_repos
103+
tmt_plan: "/plans/no-rpm/integration"
104+
identifier: "integration"
119105

120106
# Sync to Fedora
121107
- job: propose_downstream

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ test-integration:
200200
$(CONTAINER_CMD) --security-opt label=disable --cap-add=cap_mknod -v $(CURDIR):$(CONTAINER_GOSRC) -w $(CONTAINER_GOSRC) $(SKOPEO_CIDEV_CONTAINER_FQIN) \
201201
$(MAKE) test-integration-local
202202

203-
204203
# Helper target to set up SKOPEO_BINARY variable for local test targets
205204
.eval-skopeo-binary: $(if $(SKOPEO_BINARY),,bin/skopeo)
206205
$(eval SKOPEO_BINARY := $(or $(SKOPEO_BINARY),./bin/skopeo))

hack/tmt/bats-setup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
set -exo pipefail
4+
5+
# Install bats
6+
# https://bats-core.readthedocs.io/en/stable/installation.html
7+
8+
BATS_TMPDIR=$(mktemp -d)
9+
pushd "$BATS_TMPDIR"
10+
11+
BATS_VERSION=1.12.0
12+
curl -ssfL https://github.com/bats-core/bats-core/archive/refs/tags/v"$BATS_VERSION".tar.gz | tar -xz
13+
pushd bats-core-"$BATS_VERSION"
14+
./install.sh /usr
15+
popd
16+
popd

hack/tmt/dnf-repo-setup.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -exo pipefail
4+
5+
COPR_REPO_FILE=$(compgen -G "/etc/yum.repos.d/*podman-next*.repo")
6+
if [[ -n "$COPR_REPO_FILE" ]]; then
7+
# shellcheck disable=SC2016
8+
sed -i -n '/^priority=/!p;$apriority=1' "${COPR_REPO_FILE}"
9+
fi
10+
dnf -y upgrade --allowerasing

plans/main.fmf

Lines changed: 0 additions & 34 deletions
This file was deleted.

plans/no-rpm.fmf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
discover:
2+
how: fmf
3+
execute:
4+
how: tmt
5+
6+
/integration:
7+
discover+:
8+
test: /tmt/integration
9+
10+
/validate:
11+
discover+:
12+
test: /tmt/validate
13+
14+
/unit:
15+
discover+:
16+
test: /tmt/unit
17+
18+
/opengpg:
19+
prepare+:
20+
- when: distro == centos-stream or distro == rhel
21+
how: shell
22+
script: bash hack/tmt/bats-setup.sh
23+
order: 10
24+
discover+:
25+
test: /tmt/opengpg

plans/rpm.fmf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
discover:
2+
how: fmf
3+
4+
execute:
5+
how: tmt
6+
7+
prepare:
8+
- when: initiator == packit
9+
how: shell
10+
script: bash ./hack/tmt/dnf-repo-setup.sh
11+
order: 20
12+
- name: Disable installing everything from srpm
13+
how: install
14+
exclude:
15+
- ".*"
16+
- name: Install the main package
17+
how: install
18+
package:
19+
# skopeo-tests installs skopeo and other deps
20+
- skopeo-tests
21+
22+
/ostree-rs-ext:
23+
discover+:
24+
test: /tmt/ostree-rs-ext
25+
26+
/system:
27+
prepare+:
28+
- when: distro == centos-stream or distro == rhel
29+
how: shell
30+
script: bash hack/tmt/bats-setup.sh
31+
order: 10
32+
discover+:
33+
test: /tmt/system

tmt/main.fmf

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
require:
2+
# Some of these are only required for non-rpm tests but it's much simpler
3+
# to list them as common deps. Shouldn't be too much of a burden for rpm
4+
# jobs.
5+
- btrfs-progs-devel
6+
- docker-distribution
7+
- go-md2man
8+
- golang
9+
- gpgme-devel
10+
- git-core
11+
- make
12+
- skopeo-tests
13+
14+
/integration:
15+
summary: Integration test
16+
test: |
17+
rpm -q containers-common
18+
make -C $(git rev-parse --show-toplevel) test-integration-local
19+
duration: 20m
20+
21+
/ostree-rs-ext:
22+
/build:
23+
summary: ostree-rs-ext build
24+
test: bash $(git rev-parse --show-toplevel)/hack/test-ostree.sh build
25+
26+
/test:
27+
summary: ostree-rs-ext test
28+
test: |
29+
rpm -q ostree
30+
bash $(git rev-parse --show-toplevel)/hack/test-ostree.sh test
31+
require+:
32+
- ostree
33+
34+
/opengpg:
35+
# w/ opengpg will only be tested upstream, so we don't care about setting
36+
# $RELEASE_TESTING.
37+
38+
enabled: false
39+
adjust:
40+
enabled: true
41+
when: initiator == packit
42+
43+
/validate+unit:
44+
summary: System test with opengpg
45+
test: |
46+
make -C $(git rev-parse --show-toplevel) BUILDTAGS+=" containers_image_openpgp" bin/skopeo
47+
make -C $(git rev-parse --show-toplevel) test-all-local
48+
49+
/integration:
50+
summary: Integration test with opengpg
51+
test: |
52+
make -C $(git rev-parse --show-toplevel) BUILDTAGS+=" containers_image_openpgp" bin/skopeo
53+
make -C $(git rev-parse --show-toplevel) test-integration-local
54+
duration: 30m
55+
56+
/system:
57+
summary: System tests with opengpg
58+
test: |
59+
make -C $(git rev-parse --show-toplevel) BUILDTAGS+=" containers_image_openpgp" bin/skopeo
60+
make -C $(git rev-parse --show-toplevel) test-system-local
61+
duration: 30m
62+
require+:
63+
- bats
64+
65+
/system:
66+
summary: System test
67+
test: |
68+
rpm -q containers-common skopeo
69+
make -C $(git rev-parse --show-toplevel) test-system-local
70+
environment:
71+
SKOPEO_BINARY: /usr/bin/skopeo
72+
adjust:
73+
- when: initiator != "packit"
74+
environment+:
75+
RELEASE_TESTING: true
76+
duration: 60m
77+
78+
/unit:
79+
summary: Unit test
80+
test: |
81+
make -C $(git rev-parse --show-toplevel)
82+
make -C $(git rev-parse --show-toplevel) test-unit-local
83+
84+
/validate:
85+
summary: Validate test
86+
test: |
87+
make -C $(git rev-parse --show-toplevel)
88+
make -C $(git rev-parse --show-toplevel) validate-docs validate-local

0 commit comments

Comments
 (0)