Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test startup for more variations of command line args #78

Merged
merged 11 commits into from
Sep 18, 2024
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
runs-on: ubuntu-8
strategy:
matrix:
pos: [true, false]
pos: [pos, no-pos]
l3node: [l3node, l3node-token-6, no-l3node]
tokenbridge: [tokenbridge, no-tokenbridge]

steps:
- name: Checkout
Expand All @@ -36,4 +38,4 @@ jobs:
restore-keys: ${{ runner.os }}-buildx-

- name: Startup Nitro testnode
run: ${{ github.workspace }}/.github/workflows/testnode.bash ${{ matrix.pos == true && '--pos' || '' }}
run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --no-simple --detach ${{ matrix.pos == 'pos' && '--pos' || '' }}
34 changes: 11 additions & 23 deletions .github/workflows/testnode.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,36 @@
# Start the test node and get PID, to terminate it once send-l2 is done.
cd ${GITHUB_WORKSPACE}

while [[ $# -gt 0 ]]; do
case $1 in
--pos)
pos=true
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done

# TODO once develop is merged into nitro-contract's master, remove the NITRO_CONTRACTS_BRANCH env var
if [ "$pos" = true ]; then
echo "Running with --pos"
./test-node.bash --init-force --l3node --no-simple --detach --pos
else
./test-node.bash --init-force --l3node --no-simple --detach
fi
./test-node.bash "$@"

if [ $? -ne 0 ]; then
echo "test-node.bash failed"
docker compose logs --tail=1000
exit 1
fi


START=$(date +%s)
L2_TRANSACTION_SUCCEEDED=false
L3_TRANSACTION_SUCCEEDED=false
# if we're not running an l3node then we just set l3 to success by default
L3_TRANSACTION_SUCCEEDED=true
for arg in "$@"; do
if [ "$arg" = "--l3node" ]; then
L3_TRANSACTION_SUCCEEDED=false
fi
done
SUCCEEDED=false

while true; do
if [ "$L2_TRANSACTION_SUCCEEDED" = false ]; then
if ${GITHUB_WORKSPACE}/test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait; then
if ${GITHUB_WORKSPACE}/test-node.bash script send-l2 --ethamount 2 --to user_l2user --wait; then
echo "Sending l2 transaction succeeded"
L2_TRANSACTION_SUCCEEDED=true
fi
fi

if [ "$L3_TRANSACTION_SUCCEEDED" = false ]; then
if ${GITHUB_WORKSPACE}/test-node.bash script send-l3 --ethamount 100 --to user_l3user --wait; then
if ${GITHUB_WORKSPACE}/test-node.bash script send-l3 --ethamount 2 --to user_l3user --wait; then
echo "Sending l3 transaction succeeded"
L3_TRANSACTION_SUCCEEDED=true
fi
Expand Down
Loading