#!/usr/bin/env bash # This test compares "known good" output with various settings against output # with the current code. It's brittle by nature, but this is probably the # "best" approach possible. # # Notes: # * options passed to this script (such as -v) are ignored, as they would change # the output and break the test # * the number of asterisks after a "banner" differs is forced to 79 by # redirecting stdin from /dev/null set -eux run_test() { # testname is playbook name local testname=$1 # The shenanigans with redirection and 'tee' are to capture STDOUT and # STDERR separately while still displaying both to the console { ansible-playbook -i 'localhost,' -c local "${testname}.yml" \ > >(set +x; tee "${OUTFILE}.${testname}.stdout"); } \ 2> >(set +x; tee "${OUTFILE}.${testname}.stderr" >&2) 0