1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

ctdb-tests: Work around unreadable file test failure when root

root can read files for which the mode prohibits reading, so this test
case fails when run as root.  Work around this when running as root.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-07-22 11:05:21 +10:00 committed by Amitay Isaacs
parent b20ccaa36d
commit e831af7b25

View File

@ -98,9 +98,15 @@ ok_tunable ()
test_case "Unreadable file"
: >"$tfile"
chmod a-r "$tfile"
required_error EINVAL <<EOF
uid=$(id -u)
# root can read unreadable files
if [ "$uid" = 0 ]; then
ok_tunable_defaults
else
required_error EINVAL <<EOF
ctdb_tunable_load_file: Failed to open ${tfile}
EOF
fi
unit_test tunable_test "$tfile"
rm -f "$tfile"