Skip to content

Commit

Permalink
test(pay): update smoketest to include invoice request validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Jan 23, 2024
1 parent 8a754a6 commit 4614793
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ci/tasks/galoy-pay-smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set +e
for host in $(echo $hosts | jq -r '.[]'); do
galoy_pay_success="false"
lnurlp_endpoint_success="true"
lnurlp_request_invoice_success="true"

for i in {1..15}; do
echo "Attempt ${i} to curl galoy pay on host ${host}"
Expand All @@ -30,16 +31,27 @@ for host in $(echo $hosts | jq -r '.[]'); do

if [[ "$lnurl_check_disabled" != "true" ]]; then
lnurlp_endpoint_success="false"
lnurlp_request_invoice_success="false"
for i in {1..15}; do
echo "Attempt ${i} to curl lnurlp endpoint on host ${host}"
response=$(curl --location -fs ${host}/.well-known/lnurlp/test)
is_response_valid=$(echo $response | jq -r 'has("callback") and has("minSendable") and has("maxSendable") and has("metadata") and has("tag")')
if [[ "$is_response_valid" == "true" ]]; then lnurlp_endpoint_success="true"; break; fi;
sleep 1
done

if [[ "$lnurlp_endpoint_success" == "true" ]]; then
for i in {1..15}; do
echo "Attempt ${i} to curl lnurlp endpoint to request an invoice on host ${host}"
response=$(curl --location -fs ${host}/lnurlp/test/callback?amount=1000000)
is_response_valid=$(echo $response | jq -r 'has("pr") and has("routes")')
if [[ "$is_response_valid" == "true" ]]; then lnurlp_request_invoice_success="true"; break; fi;
sleep 1
done
fi;
fi

if [[ "$galoy_pay_success" != "true" || "$lnurlp_endpoint_success" != "true" ]]; then
if [[ "$galoy_pay_success" != "true" || "$lnurlp_endpoint_success" != "true" || "$lnurlp_request_invoice_success" != "true" ]]; then
echo "Smoke test failed for host ${host}"
exit 1
fi;
Expand Down

0 comments on commit 4614793

Please sign in to comment.