Skip to content

Commit

Permalink
update sidecar script (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored Oct 18, 2023
1 parent 13eae57 commit 2127668
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions packages/e2e/scripts/sidecar-chopsticks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ 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

SAS_SUBSTRATE_URL=ws://127.0.0.1:8011 SAS_EXPRESS_PORT=8111 npx --yes @substrate/api-sidecar & ACALA_SIDECAR_PID=$!
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

Expand All @@ -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

Expand Down

0 comments on commit 2127668

Please sign in to comment.