Skip to content

Commit

Permalink
test(core): move integration lnd health check to bats (#3914)
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard authored Feb 2, 2024
1 parent 2852367 commit 6ddae2b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 38 deletions.
7 changes: 0 additions & 7 deletions bats/core/api/onchain-send.bats
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ teardown() {
fi
}

grep_in_trigger_logs() {
cat_trigger \
| awk -F'' '{print $2}' \
| grep $1
return "$?"
}

wait_for_new_payout_id() {
prior_id="$1"

Expand Down
22 changes: 22 additions & 0 deletions bats/core/api/trigger.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load "../../helpers/trigger.bash"

@test "trigger: lnds health check" {
lnd1_starts_before=$(grep_in_trigger_logs "localhost:10009.*lnd.*started" | wc -l)
lnd2_starts_before=$(grep_in_trigger_logs "localhost:10010.*lnd.*started" | wc -l)

# Stop trigger
touch $TRIGGER_STOP_FILE
retry 10 1 trigger_is_stopped || exit 1

# Start trigger
rm $TRIGGER_STOP_FILE
retry 30 1 trigger_is_started

lnd1_starts_after=$(grep_in_trigger_logs "localhost:10009.*lnd.*started" | wc -l)
lnd1_diff="$(( $lnd1_starts_after - $lnd1_starts_before ))"
[[ "$lnd1_diff" == "1" ]] || exit 1

lnd2_starts_after=$(grep_in_trigger_logs "localhost:10010.*lnd.*started" | wc -l)
lnd2_diff="$(( $lnd2_starts_after - $lnd2_starts_before ))"
[[ "$lnd2_diff" == "1" ]] || exit 1
}
7 changes: 7 additions & 0 deletions bats/helpers/trigger.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ trigger_is_started() {
cat_trigger() {
cat "$TILT_LOG_FILE" | grep 'api-trigger │ '
}

grep_in_trigger_logs() {
cat_trigger \
| awk -F'' '{print $2}' \
| grep $1
return "$?"
}
31 changes: 0 additions & 31 deletions core/api/test/legacy-integration/services/lnd/health.spec.ts

This file was deleted.

0 comments on commit 6ddae2b

Please sign in to comment.