Test: minor improvements to test_lib.inc.sh

- Can now set show_logs variable from outside the script
- Better logging for assert_balance
- bake_after can now handle quoted arguments
This commit is contained in:
Milo Davis 2018-04-07 22:53:53 -04:00
parent 80cdf6d0b3
commit e6418b4602

View File

@ -34,7 +34,7 @@ register_log() {
log_files+=("$1")
}
show_logs=yes
show_logs="${show_logs:-yes}"
display_logs() {
if [ "$show_logs" = "yes" ]; then
@ -121,6 +121,7 @@ assert_balance () {
local KEY="$1"
local EXPECTED_BALANCE="$2"
local RESULT=$($client get balance for ${KEY})
echo "[Asserting balance for '$KEY']"
if [ "${RESULT}" != "${EXPECTED_BALANCE}" ]; then
printf "Balance assertion failed for ${KEY} on line '%s'. Expected %s but got %s.\n" \
"$(caller)" "${EXPECTED_BALANCE}" "${RESULT}"
@ -155,8 +156,7 @@ init_with_transfer () {
bake_after () {
local ARGS="$@"
${ARGS}
"$@"
$client bake for bootstrap1 -max-priority 512
sleep 1
}