git.delta.rocks / unique-network / refs/commits / 0722057f4b0b

difftreelog

test make testing more resilent to random failures

Yaroslav Bolyukin2023-08-31parent: #ca74825.patch.diff
in: master

2 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -117,7 +117,7 @@
     "benchMintingFee": "ts-node src/benchmarks/mintFee/benchmark.ts",
     "load": "yarn _test './**/*.load.ts'",
     "loadTransfer": "ts-node src/transfer.nload.ts",
-    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' $RPC_URL > src/interfaces/metadata.json",
+    "polkadot-types-fetch-metadata": "curl -L -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' $RPC_URL > src/interfaces/metadata.json",
     "polkadot-types-from-defs": "ts-node --esm ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",
     "polkadot-types-from-chain": "ts-node --esm ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",
     "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain",
modifiedtests/scripts/wait_for_first_block.shdiffbeforeafterboth
before · tests/scripts/wait_for_first_block.sh
1#!/usr/bin/env bash23DIR=$(dirname "$0")45. $DIR/functions.sh67function is_started {8	block_id_hex=$(do_rpc chain_getHeader | jq -r .result.number)9	block_id=$((${block_id_hex}))10	echo Id = $block_id11	if (( $block_id > 1 )); then12		return 013	fi14	return 115}1617while ! is_started; do18	echo "Waiting for first block..."19	sleep 1220done21echo "Chain is running!"
after · tests/scripts/wait_for_first_block.sh
1#!/usr/bin/env bash23DIR=$(dirname "$0")45. $DIR/functions.sh67function is_started {8	block_id_hex=$(do_rpc chain_getHeader | jq -r .result.number)9	block_id=$((${block_id_hex}))10	echo Id = $block_id11	if (( $block_id > 1 )); then12		return 013	fi14	return 115}1617while ! is_started; do18	echo "Waiting for first block..."19	sleep 1220done21echo "Chain is running, but lets wait for another block after a minute, to avoid startup flakiness."22sleep 12023while ! is_started; do24	echo "Waiting for second block..."25	sleep 1226done27echo "Chain is running!"