diff --git a/test/shell/yaml-change1.sh b/test/shell/yaml-change1.sh new file mode 100755 index 00000000..6aa7e6e3 --- /dev/null +++ b/test/shell/yaml-change1.sh @@ -0,0 +1,30 @@ +#!/bin/bash -e + +#if env | grep -q -e '^TRAVIS=true$'; 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 --kill-after=30s 20s ./mgmt run --yaml /tmp/mgmt/yaml-change.yaml --tmp-prefix & +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 $? diff --git a/test/shell/yaml-change1a.yaml b/test/shell/yaml-change1a.yaml new file mode 100644 index 00000000..b50aaa81 --- /dev/null +++ b/test/shell/yaml-change1a.yaml @@ -0,0 +1,9 @@ +--- +graph: mygraph +resources: + file: + - name: file1 + path: "/tmp/mgmt/change1" + content: 'hello world' + state: exists +edges: [] diff --git a/test/shell/yaml-change1b.yaml b/test/shell/yaml-change1b.yaml new file mode 100644 index 00000000..ef896078 --- /dev/null +++ b/test/shell/yaml-change1b.yaml @@ -0,0 +1,9 @@ +--- +graph: mygraph +resources: + file: + - name: file1 + path: "/tmp/mgmt/change1" + content: 'goodbye world' + state: exists +edges: []