test: Fix augeas test for macOS, improve test debuggability
- resolve a discrepancy in augeas behaviour on macOS - on macOS `sed` requires an argument for `-i`. - made the test fail as early as it can - provide information about why the test is failing
This commit is contained in:
committed by
James Shubin
parent
572b2575c5
commit
d33861ccb4
@@ -12,19 +12,34 @@ mkdir -p "${MGMT_TMPDIR}"
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --yaml=augeas-1.yaml &
|
||||
pid=$!
|
||||
|
||||
# kill server on error
|
||||
trap 'kill -SIGINT "$pid"' EXIT
|
||||
|
||||
sleep 10s # let it converge
|
||||
|
||||
grep "X11Forwarding no" "${MGMT_TMPDIR}"sshd_config
|
||||
# make an exception on macOS as augeas behaves differently
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
value=false
|
||||
else
|
||||
value=no
|
||||
fi
|
||||
|
||||
sed -i "s/no/yes/" "${MGMT_TMPDIR}"sshd_config
|
||||
# make it easier to see why the test failed
|
||||
set -x
|
||||
cat "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
grep "X11Forwarding ${value}" "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
sed -i '' "s/${value}/yes/" "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
grep "X11Forwarding yes" "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
sleep 10s # Augeas is slow
|
||||
|
||||
grep "X11Forwarding no" "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
grep "X11Forwarding ${value}" "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
trap '' EXIT
|
||||
killall -SIGINT mgmt # send ^C to exit mgmt
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
Reference in New Issue
Block a user