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>
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"