Skip to content

Commit c3931e7

Browse files
committed
TMT: add more tests
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent c19a6ff commit c3931e7

File tree

8 files changed

+239
-49
lines changed

8 files changed

+239
-49
lines changed

.packit.yaml

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
- job: copr_build
3131
trigger: pull_request
3232
packages: [skopeo-fedora]
33-
notifications: &copr_build_failure_notification
33+
notifications: &packit_failure_notification
3434
failure_comment:
35-
message: "Ephemeral COPR build failed. @containers/packit-build please check."
35+
message: "Packit jobs failed. @containers/packit-build please check."
3636
targets: &fedora_copr_targets
3737
- fedora-all-x86_64
3838
- fedora-all-aarch64
@@ -45,8 +45,9 @@ jobs:
4545
- job: copr_build
4646
trigger: pull_request
4747
packages: [skopeo-eln]
48-
notifications: *copr_build_failure_notification
48+
notifications: *packit_failure_notification
4949
targets: &eln_copr_targets
50+
targets:
5051
fedora-eln-x86_64:
5152
additional_repos:
5253
- "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/"
@@ -59,7 +60,7 @@ jobs:
5960
- job: copr_build
6061
trigger: ignore
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,33 +72,82 @@ 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"
93+
94+
# ostree-rs-ext tests on Fedora
95+
- job: tests
96+
trigger: pull_request
97+
packages: [skopeo-fedora]
98+
notifications: *packit_failure_notification
99+
targets: *fedora_copr_targets
100+
tf_extra_params: *extra_dnf_repos
101+
tmt_plan: "/plans/rpm/ostree-rs-ext"
102+
identifier: "ostree-rs-ext"
103+
104+
# Integration tests on Fedora
105+
- job: tests
106+
trigger: pull_request
107+
skip_build: true
108+
packages: [skopeo-fedora]
109+
notifications: *packit_failure_notification
110+
targets:
111+
# x86_6 only because of quay.io/coreos/11bot
112+
# See: integration/proxy_test.go
113+
- fedora-all
114+
tf_extra_params: *extra_dnf_repos
115+
tmt_plan: "/plans/no-rpm/integration"
116+
identifier: "integration"
117+
118+
# Unit tests on Fedora
119+
- job: tests
120+
trigger: pull_request
121+
skip_build: true
122+
notifications: *packit_failure_notification
123+
targets: &fedora_no_rpm_targets
124+
- fedora-latest-stable
125+
tmt_plan: "/plans/no-rpm/unit"
126+
identifier: "unit"
127+
128+
# Validate test on Fedora
129+
- job: tests
130+
trigger: pull_request
131+
skip_build: true
132+
notifications: *packit_failure_notification
133+
targets: *fedora_no_rpm_targets
134+
tmt_plan: "/plans/no-rpm/validate"
135+
identifier: "validate"
136+
137+
# Test w/ opengpg static linked on Fedora
138+
- job: tests
139+
trigger: pull_request
140+
skip_build: true
141+
notifications: *packit_failure_notification
142+
targets: *fedora_no_rpm_targets
143+
tmt_plan: "/plans/no-rpm/opengpg"
144+
identifier: "opengpg"
95145

96146
# Tests on ELN for main branch
97147
- job: tests
98148
trigger: pull_request
99149
packages: [skopeo-eln]
100-
notifications: *test_failure_notification
150+
notifications: *packit_failure_notification
101151
targets: *eln_copr_targets
102152
tf_extra_params:
103153
environments:
@@ -110,7 +160,7 @@ jobs:
110160
- job: tests
111161
trigger: ignore
112162
packages: [skopeo-centos]
113-
notifications: *test_failure_notification
163+
notifications: *packit_failure_notification
114164
targets: *centos_copr_targets
115165
tf_extra_params:
116166
environments:

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
# Primarily intended for CI.
205204
test-integration-local: bin/skopeo
206205
hack/warn-destructive-tests.sh

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: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
environment:
15+
BASEDIR: $(git rev-parse --show-toplevel)
16+
17+
/integration:
18+
summary: Integration test
19+
test: |
20+
rpm -q containers-common
21+
make -C $BASEDIR test-integration-local
22+
duration: 20m
23+
24+
/ostree-rs-ext:
25+
/build:
26+
summary: ostree-rs-ext build
27+
test: bash $BASEDIR/hack/test-ostree.sh build
28+
29+
/test:
30+
summary: ostree-rs-ext test
31+
test: |
32+
rpm -q ostree
33+
bash $BASEDIR/hack/test-ostree.sh test
34+
require+:
35+
- ostree
36+
37+
/opengpg:
38+
# w/ opengpg will only be tested upstream, so we don't care about setting
39+
# $RELEASE_TESTING.
40+
41+
enabled: false
42+
adjust:
43+
enabled: true
44+
when: initiator == packit
45+
46+
/validate+unit:
47+
summary: System test with opengpg
48+
test: |
49+
make -C $BASEDIR BUILDTAGS+=" containers_image_openpgp" bin/skopeo
50+
make -C $BASEDIR test-all-local
51+
52+
/integration:
53+
summary: Integration test with opengpg
54+
test: |
55+
make -C $BASEDIR BUILDTAGS+=" containers_image_openpgp" bin/skopeo
56+
make -C $BASEDIR test-integration-local
57+
duration: 30m
58+
59+
/system:
60+
summary: System tests with opengpg
61+
test: |
62+
make -C $BASEDIR BUILDTAGS+=" containers_image_openpgp" bin/skopeo
63+
make -C $BASEDIR test-system-local
64+
duration: 30m
65+
require+:
66+
- bats
67+
68+
/system:
69+
summary: System test
70+
test: |
71+
rpm -q containers-common skopeo
72+
make -C $BASEDIR test-system-local
73+
environment:
74+
SKOPEO_BINARY: /usr/bin/skopeo
75+
adjust:
76+
- when: initiator != "packit"
77+
environment+:
78+
RELEASE_TESTING: true
79+
duration: 60m
80+
81+
/unit:
82+
summary: Unit test
83+
test: |
84+
make -C $BASEDIR
85+
make -C $BASEDIR test-unit-local
86+
87+
/validate:
88+
summary: Validate test
89+
test: |
90+
make -C $BASEDIR
91+
make -C $BASEDIR validate-docs validate-local

0 commit comments

Comments
 (0)