Skip to content

Commit d982929

Browse files
committed
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 <[email protected]>
1 parent f39c9e3 commit d982929

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use std assert
2+
use tap.nu
3+
4+
# Test each directory separately for better granularity
5+
let directories = ["/boot", "/etc", "/usr"]
6+
7+
for dir in $directories {
8+
tap begin $"Run restorecon on ($dir)"
9+
10+
# Run restorecon on single directory and capture trimmed output
11+
let out = (restorecon -vnr $dir | str trim)
12+
13+
if $dir == "/boot" {
14+
# /boot is expected to have incorrect labels - known issue
15+
# See: https://github.com/bootc-dev/bootc/issues/1622
16+
print $"Note: /boot restorecon output \(expected\): ($out)"
17+
} else {
18+
# Assert it's empty for other directories
19+
assert equal $out "" $"restorecon run found incorrect labels in ($dir): ($out)"
20+
}
21+
22+
tap ok
23+
}

0 commit comments

Comments
 (0)