Skip to content

Commit

Permalink
Add test case for multiple consecutive payments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Jun 28, 2024
1 parent 6424af3 commit 399d7af
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/test04_payments_ldknode_stability.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bats

# set -eo pipefail
# set -x

setup() {
load 'test_helper/common-setup'
_common_setup

source "$PROJECT_ROOT/test/functions.sh"

TEST_COUNT=10
SUCCESS_COUNT=0
}

increment_success_count() {
(( ++SUCCESS_COUNT ))
}

print_success_count() {
echo "$SUCCESS_COUNT"
}

get_offer() {
OFFER=$(generate_offer_ldknode 'ldknode2')
}

print_offer() {
echo $OFFER
}

attempt() {
$PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $OFFER 5000000
}

@test "Multiple consecutive payments to LDK Node (lnd1 -> lnd2 -> ldknode2 x $TEST_COUNT)" {

get_offer
run print_offer

for i in $(seq 1 $TEST_COUNT)
do
run attempt
if [[ "${lines[0]}" =~ "Successfully paid for offer!" ]]; then
increment_success_count
fi
done

run print_success_count
assert_equal $SUCCESS_COUNT $TEST_COUNT
}

0 comments on commit 399d7af

Please sign in to comment.