diff --git a/optout/src/test/resources/check-conf-file.sh b/optout/src/test/resources/check-conf-file.sh index cad605d..e79c1c3 100644 --- a/optout/src/test/resources/check-conf-file.sh +++ b/optout/src/test/resources/check-conf-file.sh @@ -4,15 +4,17 @@ set -e # Echo to stderr err() { - echo 2>&1 $1 + echo 2>&1 "$@" } conf_file=$1 today=$(date +%Y%m%d) expected=$(mktemp) +err "Expected file content:" + # Use head from gnu coreutils to remove trailing newline -head -c-1 < "$expected" +head -c-1 <&1 "$expected" HDR_BENECONFIRM${today} 1S00E00JG37${today}NAccepted 00 7SP1D00AA00${today}NAccepted 00 @@ -24,6 +26,16 @@ DUMMY000007${today}NAccepted 00 TRL_BENECONFIRM${today}0000000007 EOF -err "Testing confirmation file" -diff -u "$conf_file" "$expected" -err "Confirmation file is formatted as expected" +# Print some newlines to make logs easier to read +err +err + +err "Testing confirmation file..." + +# Hide output for now to avoid revealing sensitive info +if ! diff -u "$conf_file" "$expected" > /dev/null; then + err "Confirmation file differs from expected" + exit 1 +fi + +err "Confirmation file matches expected"