c9ce27c981
Now that merge.py is invokable from another script (Ia6b6416fe10358d23f2b120283eecaf4c1178cfd) and from comments at that review, it makes sense to offer a nicer way to consume the merge functionality. Once you git clone tripleo-heat-templates you can python setup.py install and get /usr/bin/tripleo_heat_merge as well as a tripleo_heat_merge package in python2.7/site-packages. Makefile edits required because we moved merge.py into the tripleo_heat_merge directory for the packaging. Change-Id: I587fa7a826f93f89e8e5c266af7f5765438fe738
34 lines
914 B
Bash
Executable File
34 lines
914 B
Bash
Executable File
#!/bin/bash
|
|
set -ue
|
|
result=""
|
|
cleanup() {
|
|
if [ -n "$result" ] ; then
|
|
rm -f $result
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
run_test() {
|
|
local cmd=$1
|
|
local expected=$2
|
|
result=$(mktemp /tmp/test_merge.XXXXXX)
|
|
fail=0
|
|
$cmd > $result
|
|
if ! cmp $result $expected ; then
|
|
diff -u $expected $result || :
|
|
echo FAIL - $cmd result does not match expected
|
|
fail=1
|
|
else
|
|
echo PASS - $cmd
|
|
fi
|
|
cleanup
|
|
}
|
|
echo
|
|
merge_py="./tripleo_heat_merge/merge.py"
|
|
run_test "python $merge_py examples/source.yaml" examples/source_lib_result.yaml
|
|
run_test "python $merge_py examples/source2.yaml" examples/source2_lib_result.yaml
|
|
run_test "python $merge_py examples/source_include_subkey.yaml" examples/source_include_subkey_result.yaml
|
|
run_test "python $merge_py examples/launchconfig1.yaml examples/launchconfig2.yaml" examples/launchconfig_result.yaml
|
|
echo
|
|
trap - EXIT
|
|
exit $fail
|