Skip to content

Commit

Permalink
feat: added submit api port validation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Dec 11, 2024
1 parent f65152c commit c47a3e4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/e2e
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,31 @@ utxorpc_port_expect() {
exit 1
}

submit_api_port_expect() {
local key=$1

for attempt in $(seq 1 $MAX_ATTEMPT); do
status_code=$(curl -o /dev/null -s -w "%{http_code}" \
--location \
--request POST \
"https://$key.submitapi-m1.demeter.run/api/submit/tx" \
--header 'Content-Type: application/cbor' \
--data '')


if [[ -n "$status_code" && "$status_code" -eq 400 ]]; then
return 0
else
echo "SubmitApiPort is not ready yet, waiting... (attempt $attempt)"
sleep $SLEEP_DURATION
fi
done

echo "Error: SubmitApiPort is not ready after $MAX_ATTEMPT attempts."
finish
exit 1
}


echo "Configuring environment ..."

Expand Down Expand Up @@ -258,4 +283,8 @@ if (( SLOT < NODE_SLOT )); then
exit 1
fi

RESOURCE=$(create_port 'SubmitApiPort' '"{\"network\":\"mainnet\",\"throughputTier\":\"0\",\"operatorVersion\":\"1\"}"')
echo "Testing SubmitApiPort ..."
submit_api_port_expect $(echo "$(echo "$RESOURCE" | jq -r '.records[0].spec')" | jq -r '.authToken')

finish

0 comments on commit c47a3e4

Please sign in to comment.