-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fix test suite configuration script #2402
base: v1.8-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -57,16 +57,15 @@ MASTERNODE_OWNER_MASTER_PRIVATE_KEY=$(yq .hp_masternodes."$MASTERNODE_NAME".owne | |||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if [[ "$NETWORK_STRING" == "devnet"* ]]; then | ||||||||||||||||||||||||||||||||||
NETWORK=devnet | ||||||||||||||||||||||||||||||||||
INSIGHT_URL="http://insight.${NETWORK_STRING#devnet-}.networks.dash.org:3001/insight-api/sync" | ||||||||||||||||||||||||||||||||||
CERT_FLAG=":self-signed" | ||||||||||||||||||||||||||||||||||
ST_EXECUTION_INTERVAL=5000 | ||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||
NETWORK=testnet | ||||||||||||||||||||||||||||||||||
INSIGHT_URL="https://testnet-insight.dashevo.org/insight-api/sync" | ||||||||||||||||||||||||||||||||||
CERT_FLAG="" | ||||||||||||||||||||||||||||||||||
ST_EXECUTION_INTERVAL=15000 | ||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||
SKIP_SYNC_BEFORE_HEIGHT=4800 # $(curl -s $INSIGHT_URL | jq '.height - 200') | ||||||||||||||||||||||||||||||||||
INSIGHT_URL="http://insight.${NETWORK_STRING#devnet-}.networks.dash.org:3001/insight-api/sync" | ||||||||||||||||||||||||||||||||||
SKIP_SYNC_BEFORE_HEIGHT=$(curl -s $INSIGHT_URL | jq '.height - 200') | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for height calculation The curl command and height calculation lack error handling for network issues or invalid responses. Consider adding: - SKIP_SYNC_BEFORE_HEIGHT=$(curl -s $INSIGHT_URL | jq '.height - 200')
+ # Add timeout and retry logic for curl
+ SYNC_DATA=$(curl -s -f --max-time 10 --retry 3 --retry-delay 2 $INSIGHT_URL)
+ if [ $? -ne 0 ]; then
+ echo "Error: Failed to fetch sync data from $INSIGHT_URL"
+ exit 1
+ fi
+
+ # Validate height exists and is a number
+ HEIGHT=$(echo "$SYNC_DATA" | jq -e '.height')
+ if [ $? -ne 0 ] || ! [[ "$HEIGHT" =~ ^[0-9]+$ ]]; then
+ echo "Error: Invalid height received from insight API"
+ exit 1
+ fi
+
+ SKIP_SYNC_BEFORE_HEIGHT=$((HEIGHT - 200)) 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# check variables are not empty | ||||||||||||||||||||||||||||||||||
if [ -z "$FAUCET_ADDRESS" ] || \ | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add validation for INSIGHT_URL construction
The dynamic URL construction using string manipulation could fail if the network string format changes. Consider adding validation:
📝 Committable suggestion