-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chain sync test * finish * move to release gha
- Loading branch information
1 parent
87fbaaa
commit 05f63c3
Showing
2 changed files
with
86 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# first argument is chain | ||
chain="$@" | ||
|
||
# run node | ||
./target/release/astar-collator --chain $chain --no-telemetry --no-prometheus --tmp -- --no-telemetry --no-prometheus & CHAIN_PID=$! | ||
|
||
printf "Waiting for RPC to be ready" | ||
attempts=12 # 1 minutes | ||
until nc -z localhost 9944; do | ||
attempts=$((attempts - 1)) | ||
if [ $attempts -eq 0 ]; then | ||
echo "ERROR: Chain RPC failed to start" | ||
exit 1 | ||
fi | ||
sleep 5 | ||
done | ||
|
||
printf "Waiting for 30 seconds to sync at least 1000 blocks" | ||
sleep 30 | ||
|
||
number=$(curl --location http://localhost:9944 \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"jsonrpc": "2.0", | ||
"method": "chain_getHeader", | ||
"params": [], | ||
"id": 1 | ||
}' | jq '.result.number' | xargs printf "%d") | ||
|
||
if [ "$number" -lt 1000 ]; then | ||
echo "ERROR: Chain failed to sync 1000 blocks in 30 seconds" | ||
exit 1 | ||
fi | ||
|
||
kill $CHAIN_PID |