From 0259cbb8d124681a1bead79b0a8cdf53aaeb5e6b Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Fri, 22 Dec 2023 22:36:04 -0400 Subject: [PATCH] refactor: change trigger_is_started to be exact --- bats/helpers/trigger.bash | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bats/helpers/trigger.bash b/bats/helpers/trigger.bash index d7be8bdd69..c059536a7e 100644 --- a/bats/helpers/trigger.bash +++ b/bats/helpers/trigger.bash @@ -13,14 +13,9 @@ trigger_is_stopped() { } trigger_is_started() { - local NUM_LINES=18 - cat $TILT_LOG_FILE | grep 'api-trigger │' \ - | tail -n $NUM_LINES \ - | grep "Successfully stopped trigger" + lastLineNum=$(grep -n 'Successfully stopped trigger' "$TILT_LOG_FILE" | tail -1 | cut -d: -f1) + if [[ -z "$lastLineNum" ]]; then lastLineNum=0; fi - if [[ "$?" == "0" ]]; then - return 1 - else - return 0 - fi + tail -n +$((lastLineNum + 1)) "$TILT_LOG_FILE" | grep -q 'finish updating pending invoices' + return $? }