From d9829296ea0cf69fde37d16af42218105326d360 Mon Sep 17 00:00:00 2001 From: Joseph Marrero Corchado Date: Wed, 1 Oct 2025 16:09:28 -0400 Subject: [PATCH] tests: add restorecon checks for /usr, /etc and /boot Verify that deployments have correct selinux labels from the base image. Signed-off-by: Joseph Marrero Corchado --- .../booted/readonly/025-test-restorecon.nu | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tmt/tests/booted/readonly/025-test-restorecon.nu diff --git a/tmt/tests/booted/readonly/025-test-restorecon.nu b/tmt/tests/booted/readonly/025-test-restorecon.nu new file mode 100644 index 000000000..14d3914ca --- /dev/null +++ b/tmt/tests/booted/readonly/025-test-restorecon.nu @@ -0,0 +1,23 @@ +use std assert +use tap.nu + +# Test each directory separately for better granularity +let directories = ["/boot", "/etc", "/usr"] + +for dir in $directories { + tap begin $"Run restorecon on ($dir)" + + # Run restorecon on single directory and capture trimmed output + let out = (restorecon -vnr $dir | str trim) + + if $dir == "/boot" { + # /boot is expected to have incorrect labels - known issue + # See: https://github.com/bootc-dev/bootc/issues/1622 + print $"Note: /boot restorecon output \(expected\): ($out)" + } else { + # Assert it's empty for other directories + assert equal $out "" $"restorecon run found incorrect labels in ($dir): ($out)" + } + + tap ok +}