Add functional tests and examples for merge
[apex-tripleo-heat-templates.git] / test_merge.bash
1 #!/bin/bash
2 set -ue
3 result=""
4 cleanup() {
5     if [ -n "$result" ] ; then
6         rm -f $result
7     fi
8 }
9 trap cleanup EXIT
10 result=$(mktemp /tmp/test_merge.XXXXXX)
11 fail=0
12 python merge.py examples/source.yaml > $result
13 if ! cmp $result examples/source_lib_result.yaml ; then
14     diff -u $result examples/source_lib_result.yaml
15     echo
16     echo FAIL - merge of source.yaml result does not match expected output
17     echo
18     fail=1
19 else
20     echo
21     echo PASS - merge of source.yaml result matches expected output
22     echo
23 fi
24 exit $fail