Skip to content

Commit 265b592

Browse files
committed
Add sysctl case for FFI
Test case will execute sysctl inside nested container running on top of QM Jira-URL: https://issues.redhat.com/browse/VROOM-19309 Signed-off-by: weiwang <[email protected]>
1 parent d5a4668 commit 265b592

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Diff for: tests/ffi/sysctl/main.fmf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: Executing sysctl inside nested container running on top of QM
2+
test: /bin/bash ./test.sh
3+
duration: 20m
4+
tag: ffi
5+
framework: shell
6+
id: f615d356-9bf9-4de2-a007-7a99eca2bc48

Diff for: tests/ffi/sysctl/test.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash -euvx
2+
3+
# shellcheck disable=SC1091
4+
5+
. ../common/prepare.sh
6+
7+
export QM_HOST_REGISTRY_DIR="/var/qm/lib/containers/registry"
8+
export QM_REGISTRY_DIR="/var/lib/containers/registry"
9+
10+
disk_cleanup
11+
prepare_test
12+
reload_config
13+
14+
exec_cmd "podman run -d --rm --replace -d --name ffi-asil \
15+
quay.io/centos-sig-automotive/ffi-tools:latest > /dev/null"
16+
17+
image_id=$(podman images | grep quay.io/centos-sig-automotive/ffi-tools | awk -F " " '{print $3}')
18+
19+
if [ -z $image_id ];then
20+
if_error_exit "NO ffi-tools IMAGE!!!"
21+
exit 1
22+
fi
23+
24+
if [ ! -d "${QM_HOST_REGISTRY_DIR}" ]; then
25+
exec_cmd "mkdir -p ${QM_HOST_REGISTRY_DIR}"
26+
exec_cmd "podman push ${image_id} dir:${QM_HOST_REGISTRY_DIR}/ffi-tools:latest"
27+
fi
28+
29+
sysctl_num=$(podman exec qm /bin/bash -c \
30+
"podman run --replace --name ffi-qm dir:${QM_REGISTRY_DIR}/ffi-tools:latest \
31+
./setsysctl 2>&1" | grep -c "sysctl: permission denied on key")
32+
33+
if [ $sysctl_num -ge 5 ];then
34+
info_message "Attempt to change OS level are denied successfully inside QM container."
35+
exit 0
36+
fi

0 commit comments

Comments
 (0)