Files
mgmt/test/shell/yaml-change1.sh
Karpfen 7e8ced534f misc: Use /usr/bin/env for a more generic shebang
Use path based SHELL in Makefiles. It was suggested that this is a
better solution for make for cases when there is no /usr/bin/env.

See: https://github.com/purpleidea/mgmt/pull/694#discussion_r1015596204
2025-03-22 14:53:21 -04:00

35 lines
1011 B
Bash
Executable File

#!/usr/bin/env -S bash -e
. "$(dirname "$0")/../util.sh"
exit 0 # TODO: this test needs to be updated to use deploys instead
#if in_env; then
# # inotify doesn't seem to work properly on travis
# echo "Travis and Jenkins give wonky results here, skipping test!"
# exit
#fi
if [ -z $timeout ]; then
timeout='timeout'
fi
# set the config file
cp -a yaml-change1a.yaml /tmp/mgmt/yaml-change.yaml
$TIMEOUT "$MGMT" run --tmp-prefix yaml /tmp/mgmt/yaml-change.yaml &
pid=$!
sleep 5s # let it converge
grep -q 'hello world' /tmp/mgmt/change1 # check contents are correct
cp -a yaml-change1b.yaml /tmp/mgmt/yaml-change.yaml # change the config file
sleep 2s # let it converge
grep -q 'goodbye world' /tmp/mgmt/change1 # check new contents are correct
cp -a yaml-change1a.yaml /tmp/mgmt/yaml-change.yaml # change the config file
sleep 2s # let it converge
grep -q 'hello world' /tmp/mgmt/change1 # check contents are correct again
killall -SIGINT mgmt # send ^C to exit mgmt
wait $pid # get exit status
exit $?