Skip to content

Commit

Permalink
tests/ffi: add test checking /sys is read-only
Browse files Browse the repository at this point in the history
Test to ensure that /sys is read-only inside the
QM container.

Signed-off-by: Albert Esteve <[email protected]>
  • Loading branch information
aesteve-rh committed Nov 26, 2024
1 parent e5bc702 commit 029685c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/ffi/sys_read_only/PURPOSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Title:
Verifies that /sys is read-only in QM partition.

Description:
This test executes `test -r /sys && test ! -w /sys` in QM partition, no other input.
podman exec qm "test -r /sys && test ! -w /sys"

Expected result:
out: [ INFO ] PASS: check_sys_read_only: As expected, /sys is read-only in QM partition.

Jira:
VROOM-24445
7 changes: 7 additions & 0 deletions tests/ffi/sys_read_only/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# FFI - sys_read_only

This test is intended to confirm that /sys is read-only in QM partition.

## This Test Set includes these tests

1. Confirm that /sys is read-only in QM partition.
19 changes: 19 additions & 0 deletions tests/ffi/sys_read_only/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Test that /sys is read-only in QM partition.
description: |
This tests confirms that /sys folder is present and read-only in the QM
partition. The test executes `test -r /sys && test ! -w /sys` in QM
partition, no other input.

Test inputs:
None

Expected results:
out: [ INFO ] PASS: check_sys_read_only: As expected, /sys is read-only in QM partition.

Results location:
output.txt
contact: Albert Esteve <[email protected]>
test: /bin/bash ./test.sh
duration: 10m
tag: ffi
framework: shell
18 changes: 18 additions & 0 deletions tests/ffi/sys_read_only/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -euvx

# shellcheck disable=SC1091
. ../../e2e/lib/utils

check_sys_read_only(){
# Check /sys is read-only in QM partition
if podman exec qm /bin/sh -c 'test -r /sys && test ! -w /sys'; then
info_message "PASS: check_sys_read_only: As expected, /sys is read-only in QM partition."
exit 0
else
info_message "Found a non-read-only /sys folder in QM partition: $(podman exec -t qm ls -ld /sys)"
info_message "FAIL: check_sys_read_only: Check for /sys in QM partition failed, it should be read-only."
exit 1
fi
}

check_sys_read_only

0 comments on commit 029685c

Please sign in to comment.