Commit 87cae25c authored by Vincent Pelletier's avatar Vincent Pelletier

shell/caucase.sh: Factorise self-test failure codepath.

parent e5e13cd0
......@@ -1190,6 +1190,12 @@ EOF
caucased_dir \
caucased_type \
caucased_pid
_fail () {
# shellcheck disable=SC2059
printf "$@"
find . -ls
exit 1
}
echo 'Automated testing...'
if command -v caucased > /dev/null; then
caucased_type="path"
......@@ -1288,29 +1294,21 @@ EOF
| sed 's/\s.*//' \
)"
if [ ! -d cas_crt ]; then
echo 'cas_crt not created'
find . -ls
return 1
_fail 'cas_crt not created\n'
fi
for cas_file in cas_crt/*; do
if [ -r "$cas_file" ] && [ ! -h "$cas_file" ]; then
if [ "$cas_found" -eq 1 ]; then
echo 'Multiple CAS CA certificates found'
find . -ls
return 1
_fail 'Multiple CAS CA certificates found\n'
fi
cas_found=1
fi
done
if [ "$cas_found" -eq 0 ]; then
echo 'No CAS CA certificates found, but directory exists'
find . -ls
return 1
_fail 'No CAS CA certificates found, but directory exists\n'
fi
if [ ! -f cau.crt.pem ]; then
echo 'cau.crt.pem not created'
find . -ls
return 1
_fail 'cau.crt.pem not created\n'
fi
echo 'Retrieving auto-issued user certificate...'
if _main \
......@@ -1321,9 +1319,7 @@ EOF
then
:
else
echo 'Failed to receive signed user certificate.'
find . -ls
return 1
_fail 'Failed to receive signed user certificate.\n'
fi
echo 'Using the user certificate...'
if _main \
......@@ -1334,9 +1330,7 @@ EOF
> /dev/null; then
:
else
echo 'Failed to list pending CSR, authentication failed ?'
find . -ls
return 1
_fail 'Failed to list pending CSR, authentication failed ?\n'
fi
echo 'Success'
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment