From 2127668735585c37b7259f14d3661bce733dcdb5 Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Wed, 18 Oct 2023 16:47:41 +0200 Subject: [PATCH] update sidecar script (#454) --- packages/e2e/scripts/sidecar-chopsticks.sh | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/e2e/scripts/sidecar-chopsticks.sh b/packages/e2e/scripts/sidecar-chopsticks.sh index cf09c156..aad177d4 100755 --- a/packages/e2e/scripts/sidecar-chopsticks.sh +++ b/packages/e2e/scripts/sidecar-chopsticks.sh @@ -7,7 +7,13 @@ yarn dev:acala --port 8011 & ACALA_PID=$! yarn dev:karura --port 8012 & KARURA_PID=$! printf "Waiting for chains to be ready" +attempts=30 # 5 minutes until nc -z localhost 8011 && nc -z localhost 8012; do + attempts=$((attempts - 1)) + if [ $attempts -eq 0 ]; then + echo "Chains failed to start" + exit 1 + fi sleep 5 done @@ -15,7 +21,13 @@ SAS_SUBSTRATE_URL=ws://127.0.0.1:8011 SAS_EXPRESS_PORT=8111 npx --yes @substrate SAS_SUBSTRATE_URL=ws://127.0.0.1:8012 SAS_EXPRESS_PORT=8112 npx --yes @substrate/api-sidecar & KARURA_SIDECAR_PID=$! printf "Waiting for sidecars to be ready" +attempts=30 # 5 minutes until nc -z localhost 8111 && nc -z localhost 8112; do + attempts=$((attempts - 1)) + if [ $attempts -eq 0 ]; then + echo "Sidecars failed to start" + exit 1 + fi sleep 5 done @@ -26,20 +38,17 @@ git clone --depth 1 --branch v17.2.0 --single-branch https://github.com/parityte cd substrate-api-sidecar yarn install -# run the tests -npx --yes ts-node e2e-tests/latest/index.ts --chain acala --url http://127.0.0.1:8111 +npx --yes ts-node --transpile-only e2e-tests/latest/index.ts --chain acala --url http://127.0.0.1:8111 ACALA_TEST_RESULT=$? -npx --yes ts-node e2e-tests/latest/index.ts --chain karura --url http://127.0.0.1:8112 +npx --yes ts-node --transpile-only e2e-tests/latest/index.ts --chain karura --url http://127.0.0.1:8112 KARURA_TEST_RESULT=$? cd .. # cleanup -kill $ACALA_SIDECAR_PID -kill $KARURA_SIDECAR_PID -kill $ACALA_PID -kill $KARURA_PID +kill -s INT $(pgrep -P $ACALA_SIDECAR_PID) $(pgrep -P $KARURA_SIDECAR_PID) +kill $ACALA_SIDECAR_PID $KARURA_SIDECAR_PID $ACALA_PID $KARURA_PID rm -rf substrate-api-sidecar