#!/bin/sh
# Make sure that fragmented configuration works as expected.

set -e

. debian/tests/helper-functions

printf 'Setting "authselectmode prefer" as authentication policy: '
echo "authselectmode prefer" > /etc/chrony/conf.d/authentication-policy.conf && __test_ok || __test_fail

printf "Restart chronyd: "
systemctl --quiet restart chrony.service && __test_ok || __test_fail

printf "Checking that chronyd uses the defined authentication policy: "
chronyd -p 2> /dev/null | grep -q "authselectmode prefer" && __test_ok || __test_fail

exit 0
