Skip to content

Commit

Permalink
Add --start-relayer arg
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Feb 13, 2024
1 parent 4c96dca commit 5abe478
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
17 changes: 8 additions & 9 deletions bridges/zombienet/environments/rococo-westend/spawn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ set -e

trap "trap - SIGTERM && kill -9 -$$" SIGINT SIGTERM EXIT

source "${BASH_SOURCE%/*}/../../utils/common.sh"
source "${BASH_SOURCE%/*}/../../utils/zombienet.sh"

# whether to init the chains (open HRMP channels, set XCM version, create reserve assets, etc)
init=0
start_relayer=0
while [ $# -ne 0 ]
do
arg="$1"
case "$arg" in
--init)
init=1
;;
--start-relayer)
start_relayer=1
;;
esac
shift
done
Expand Down Expand Up @@ -55,17 +58,13 @@ if [[ $init -eq 1 ]]; then
run_zndsl ${BASH_SOURCE%/*}/westend-init.zndsl $westend_dir
fi

relay_log=$logs_dir/relay.log
echo -e "Starting rococo-westend relay. Logs available at: $relay_log\n"
start_background_process "$helper_script run-relay" $relay_log relay_pid
if [[ $start_relayer -eq 1 ]]; then
${BASH_SOURCE%/*}/start_relayer.sh $rococo_dir $westend_dir relayer_pid
fi

run_zndsl ${BASH_SOURCE%/*}/rococo.zndsl $rococo_dir
echo $rococo_dir > $TEST_DIR/rococo.env
echo

run_zndsl ${BASH_SOURCE%/*}/westend.zndsl $westend_dir
echo $westend_dir > $TEST_DIR/westend.env
echo

wait -n $rococo_pid $westend_pid $relay_pid
wait -n $rococo_pid $westend_pid $relayer_pid
kill -9 -$$
23 changes: 23 additions & 0 deletions bridges/zombienet/environments/rococo-westend/start_relayer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

source "${BASH_SOURCE%/*}/../../utils/common.sh"
source "${BASH_SOURCE%/*}/../../utils/zombienet.sh"

rococo_dir=$1
westend_dir=$2
__relayer_pid=$3

logs_dir=$TEST_DIR/logs
helper_script="${BASH_SOURCE%/*}/helper.sh"

relayer_log=$logs_dir/relayer.log
echo -e "Starting rococo-westend relayer. Logs available at: $relayer_log\n"
start_background_process "$helper_script run-relay" $relayer_log relayer_pid

run_zndsl ${BASH_SOURCE%/*}/rococo.zndsl $rococo_dir
run_zndsl ${BASH_SOURCE%/*}/westend.zndsl $westend_dir

eval $__relayer_pid="'$relayer_pid'"

4 changes: 2 additions & 2 deletions bridges/zombienet/run-new-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

trap 'kill -9 -$$ || echo "Environment already teared down"' SIGINT SIGTERM EXIT

test=$1
shift

Expand Down Expand Up @@ -43,5 +45,3 @@ export TEST_DIR=`mktemp -d /tmp/bridges-tests-run-XXXXX`
echo -e "Test folder: $TEST_DIR\n"

${BASH_SOURCE%/*}/tests/$test/run.sh

kill -9 -$$ || echo "Environment already teared down"
2 changes: 1 addition & 1 deletion bridges/zombienet/tests/0001-asset-transfer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
source "${BASH_SOURCE%/*}/../../utils/common.sh"
source "${BASH_SOURCE%/*}/../../utils/zombienet.sh"

${BASH_SOURCE%/*}/../../environments/rococo-westend/spawn.sh --init &
${BASH_SOURCE%/*}/../../environments/rococo-westend/spawn.sh --init --start-relayer &
env_pid=$!

ensure_process_file $env_pid $TEST_DIR/rococo.env 400
Expand Down

0 comments on commit 5abe478

Please sign in to comment.