Skip to content

Commit 7389a9a

Browse files
committed
TMT: re-enable podman e2e revdep tests
We need to run podman e2e tests as they are not the same as system tests. For example: `podman container restore --pod ...` test isn't run in the system tests and this test is currently failing on RHEL. This reverts commit 3f2d85a and makes additional changes to suit current state. Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent d7e420a commit 7389a9a

File tree

4 files changed

+113
-16
lines changed

4 files changed

+113
-16
lines changed

plans/main.fmf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ prepare:
66
- when: distro == centos-stream or distro == rhel
77
how: shell
88
script: |
9-
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval '%{?rhel}').noarch.rpm
10-
dnf -y config-manager --set-enabled epel
9+
BATS_VERSION=1.12.0
10+
curl -L https://github.com/bats-core/bats-core/archive/refs/tags/v"$BATS_VERSION".tar.gz | tar -xf
11+
cd bats-core-"$BATS_VERSION"
12+
./install.sh /usr
1113
order: 10
1214
- when: initiator == packit
1315
how: shell
@@ -18,3 +20,15 @@ prepare:
1820
fi
1921
dnf -y upgrade --allowerasing
2022
order: 20
23+
24+
/basic_check:
25+
discover+:
26+
filter: 'tag:basic'
27+
28+
/podman_e2e_test:
29+
discover+:
30+
filter: 'tag:podman_e2e'
31+
32+
/podman_system_test:
33+
discover+:
34+
filter: 'tag:podman_system'

test/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: basic_check
2+
basic_check:
3+
semodule --list=full | grep container
4+
semodule -B
5+
rpm -Vqf /var/lib/selinux/*/active/modules/200/container
6+
7+
.PHONY: podman_e2e_test
8+
podman_e2e_test:
9+
bash ./podman-tests.sh e2e
10+
11+
.PHONY: podman_system_test
12+
podman_system_test:
13+
bash ./podman-tests.sh system
14+
15+
clean:
16+
rm -rf podman-*dev* podman.spec

test/main.fmf

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1+
# Only common dependencies that are NOT required to run podman-tests.sh are
2+
# specified here. Everything else is in podman-tests.sh.
13
require:
2-
- attr
3-
- bats
4-
- container-selinux
5-
- podman-tests
6-
- policycoreutils
4+
- make
75

86
/basic_check:
97
summary: Run basic checks
10-
test: |
11-
semodule --list=full | grep container
12-
semodule -B
13-
rpm -Vqf /var/lib/selinux/*/active/modules/200/container
8+
tag: [ basic ]
9+
test: make basic_check
10+
require+:
11+
- policycoreutils
12+
13+
/podman_e2e_test:
14+
summary: Run SELinux specific Podman e2e tests
15+
tag: [ podman_e2e ]
16+
test: make podman_e2e_test
17+
require+:
18+
- btrfs-progs-devel
19+
- cpio
20+
- golang
21+
- gpgme-devel
22+
- podman
23+
- zstd
1424

1525
/podman_system_test:
26+
tag: [ podman_system ]
1627
summary: Run SELinux specific Podman system tests
17-
test: bash ./podman-tests.sh
28+
test: make podman_system_test
29+
require+:
30+
- podman-tests

test/podman-tests.sh

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,62 @@ if [[ "$(id -u)" -ne 0 ]];then
99
exit 1
1010
fi
1111

12-
# Print versions of distro and installed packages
13-
rpm -q bats container-selinux podman podman-tests policycoreutils selinux-policy
12+
if [[ -z "$1" ]]; then
13+
echo -e "Usage: $(basename "${BASH_SOURCE[0]}") TEST_TYPE\nTEST_TYPE can be 'e2e' or 'system'\n"
14+
exit 1
15+
fi
16+
17+
TEST_TYPE=$1
18+
19+
export PODMAN_BINARY=/usr/bin/podman
20+
21+
# Remove testing-farm repos if they exist as these interfere with the packages
22+
# we want to install, especially when podman-next copr is involved
23+
rm -f /etc/yum.repos.d/tag-repository.repo
24+
25+
if [[ "$TEST_TYPE" == "e2e" ]]; then
26+
rpm -q container-selinux golang podman selinux-policy
27+
28+
# /tmp is often unsufficient
29+
export TMPDIR=/var/tmp
30+
31+
# Fetch and extract latest podman source from the highest priority dnf repo
32+
# NOTE: On upstream pull-requests, the srpm will be fetched from the
33+
# podman-next copr while on bodhi updates, it will be fetched from Fedora's
34+
# official repos.
35+
PODMAN_DIR=$(mktemp -d)
36+
pushd "$PODMAN_DIR"
1437

15-
# Run podman system tests
16-
bats /usr/share/podman/test/system/410-selinux.bats
38+
# Download srpm, srpm opts differ between dnf and dnf5
39+
if ! rpm -q dnf5; then
40+
dnf download --source podman
41+
else
42+
dnf download --srpm podman
43+
fi
44+
45+
# Extract and untar podman source from srpm
46+
rpm2cpio "$(ls podman*.src.rpm)" | cpio -di
47+
tar zxf ./*.tar.gz
48+
49+
popd
50+
51+
if [[ "$(arch)" == "x86_64" ]]; then
52+
ARCH=amd64
53+
else
54+
ARCH=arm64
55+
fi
56+
57+
# Run podman e2e tests
58+
pushd "$PODMAN_DIR"/podman-*/test/e2e
59+
go test -v config.go config_test.go config_"$ARCH".go common_test.go libpod_suite_test.go run_selinux_test.go
60+
go test -v config.go config_test.go config_"$ARCH".go common_test.go libpod_suite_test.go checkpoint_test.go
61+
popd
62+
fi
63+
64+
if [[ "$TEST_TYPE" == "system" ]]; then
65+
rpm -q container-selinux podman podman-tests selinux-policy
66+
67+
# Run podman system tests
68+
bats /usr/share/podman/test/system/410-selinux.bats
69+
bats /usr/share/podman/test/system/520-checkpoint.bats
70+
fi

0 commit comments

Comments
 (0)