Files
mgmt/test/shell/file-move.sh
James Shubin 9969286224 engine: Resources package rewrite
This giant patch makes some much needed improvements to the code base.

* The engine has been rewritten and lives within engine/graph/
* All of the common interfaces and code now live in engine/
* All of the resources are in one package called engine/resources/
* The Res API can use different "traits" from engine/traits/
* The Res API has been simplified to hide many of the old internals
* The Watch & Process loops were previously inverted, but is now fixed
* The likelihood of package cycles has been reduced drastically
* And much, much more...

Unfortunately, some code had to be temporarily removed. The remote code
had to be taken out, as did the prometheus code. We hope to have these
back in new forms as soon as possible.
2018-04-19 01:10:58 -04:00

40 lines
957 B
Bash
Executable File

#!/bin/bash -e
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\]: resource: contentCheckApply(true)' /tmp/mgmt/file-move.log)
mv /tmp/mgmt/f1 /tmp/mgmt/f2
sleep 3s
after_move_count=$(grep -c 'file\[file1\]: resource: contentCheckApply(true)' /tmp/mgmt/file-move.log)
sleep 3s
echo f2 > /tmp/mgmt/f2
after_moved_file_count=$(grep -c 'file\[file1\]: resource: 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 $?