Files
mgmt/test/shell/file-move.sh
James Shubin 644e5164b1 test: Increase timeouts for when travis is slow
Hopefully this cuts down on spurious failures.
2018-02-12 15:08:47 -05:00

47 lines
1.0 KiB
Bash
Executable File

#!/bin/bash -e
if [[ $(uname) == "Darwin" ]] ; then
# https://github.com/purpleidea/mgmt/issues/33
echo "This test is broken on macOS, skipping!"
exit
fi
mkdir -p /tmp/mgmt/
rm /tmp/mgmt/f1 || true
# run empty graph, with prometheus support
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
pid=$!
sleep 5s # let it converge
initial=$(grep -c 'file\[file1\]: contentCheckApply(true)' /tmp/mgmt/file-move.log)
mv /tmp/mgmt/f1 /tmp/mgmt/f2
sleep 3
after_move_count=$(grep -c 'file\[file1\]: contentCheckApply(true)' /tmp/mgmt/file-move.log)
sleep 3
echo f2 > /tmp/mgmt/f2
after_moved_file_count=$(grep -c 'file\[file1\]: contentCheckApply(true)' /tmp/mgmt/file-move.log)
if [[ ${after_move_count} -le ${initial} ]]
then
echo File move did not trigger a CheckApply
exit 1
fi
if [[ ${after_moved_file_count} -gt ${after_move_count} ]]
then
echo Changing the moved file did trigger a CheckApply
exit 1
fi
killall -SIGINT mgmt # send ^C to exit mgmt
wait $pid # get exit status
exit $?