Skip to content

Commit

Permalink
TMT: Add sanity tests from c9s downstream
Browse files Browse the repository at this point in the history
This commit upstreams sanity tests added to CentOS Stream 9
contributed by Alex Jia <[email protected]>
Ref: https://gitlab.com/redhat/centos-stream/rpms/crun/-/merge_requests/117

These tests will now run for all active Fedora and CentOS Stream.

The existing podman system tests have also been made more idiomatic.

The rpm gating config also has updated rules for rhel updates.

Signed-off-by: Lokesh Mandvekar <[email protected]>
  • Loading branch information
lsm5 committed Dec 26, 2024
1 parent d08e304 commit ec5947c
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 44 deletions.
28 changes: 24 additions & 4 deletions plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +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 crun specific Podman system 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 crun specific Podman system tests on bodhi / errata and dist-git PRs
discover+:
filter: tag:downstream
adjust+:
enabled: false
when: initiator == packit
- enabled: false
when: initiator == packit
7 changes: 5 additions & 2 deletions rpm/gating.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
decision_context:
- bodhi_update_push_stable
- bodhi_update_push_testing
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}
3 changes: 0 additions & 3 deletions tests/tmt/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions tests/tmt/main.fmf

This file was deleted.

22 changes: 0 additions & 22 deletions tests/tmt/podman-tests.sh

This file was deleted.

15 changes: 15 additions & 0 deletions tests/tmt/podman/system-test.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require:
- bats
- conmon
- crun
- make
- podman-tests

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

/system_test:
tag: [ upstream, downstream ]
summary: Run crun specific Podman tests
test: bash ./system-test.sh
16 changes: 16 additions & 0 deletions tests/tmt/podman/system-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -exo pipefail

if [[ "$(id -u)" -ne 0 ]];then
echo "Please run this script as superuser"
exit 1
fi

cat /etc/redhat-release
rpm -q conmon containers-common crun podman podman-tests

# Run crun specific podman tests
bats -t /usr/share/podman/test/system/030-run.bats
bats -t /usr/share/podman/test/system/075-exec.bats
bats -t /usr/share/podman/test/system/280-update.bats
180 changes: 180 additions & 0 deletions tests/tmt/sanity/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"ociVersion": "1.0.0",
"process": {
"terminal": false,
"user": {
"uid": 0,
"gid": 0
},
"args": [
"sleep", "10"
],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": "/",
"capabilities": {
"bounding": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"effective": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"inheritable": [
],
"permitted": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
"ambient": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
]
},
"rlimits": [
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
],
"noNewPrivileges": true
},
"root": {
"path": "rootfs",
"readonly": true
},
"hostname": "crun",
"mounts": [
{
"destination": "/proc",
"type": "proc",
"source": "proc"
},
{
"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": [
"nosuid",
"strictatime",
"mode=755",
"size=65536k"
]
},
{
"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [
"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620",
"gid=5"
]
},
{
"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": [
"nosuid",
"noexec",
"nodev",
"mode=1777",
"size=65536k"
]
},
{
"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": [
"nosuid",
"noexec",
"nodev"
]
},
{
"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": [
"nosuid",
"noexec",
"nodev",
"ro"
]
},
{
"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": [
"nosuid",
"noexec",
"nodev",
"relatime",
"ro"
]
}
],
"linux": {
"resources": {
"devices": [
{
"allow": false,
"access": "rwm"
}
]
},
"namespaces": [
{
"type": "pid"
},
{
"type": "network"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "cgroup"
},
{
"type": "mount"
}
],
"maskedPaths": [
"/proc/acpi",
"/proc/asound",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/sys/firmware",
"/proc/scsi"
],
"readonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
}
}
5 changes: 5 additions & 0 deletions tests/tmt/sanity/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require: [crun, podman]
summary: Sanity test for crun
tag: ['upstream', 'downstream']
test: bash ./runtest.sh
duration: 10m
Loading

0 comments on commit ec5947c

Please sign in to comment.