diff --git a/yarn-project/end-to-end/Earthfile b/yarn-project/end-to-end/Earthfile index 843e7eec2c2..83f95c3712f 100644 --- a/yarn-project/end-to-end/Earthfile +++ b/yarn-project/end-to-end/Earthfile @@ -1,327 +1,297 @@ VERSION 0.8 -E2E_COMPOSE_TEST: - FUNCTION - ARG test - ARG compose_file=./scripts/docker-compose.yml - ARG debug="aztec:*" - ARG hardware_concurrency="" - LOCALLY - ENV TEST=$test - ENV DEBUG=$debug - ENV HARDWARE_CONCURRENCY=$hardware_concurrency - LET project_name=$(echo $test | sed 's/\./_/g' | sed 's/\//_/g') - IF docker compose > /dev/null 2>&1 - LET CMD="docker compose" - ELSE - LET CMD="docker-compose" - END - # Let docker compose know about the pushed tags above - ENV AZTEC_DOCKER_TAG=$(git rev-parse HEAD) - # Optimize to not cause serial behavior if image already exists - IF ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ - ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" - WAIT - BUILD ../+export-e2e-test-images - END - END - # Run our docker compose, ending whenever sandbox ends, filtering out noisy eth_getLogs - ENV JOB_NAME=$project_name - RUN $CMD -p $project_name -f $compose_file up --exit-code-from=end-to-end --force-recreate - -E2E_TEST: - FUNCTION - ARG hardware_concurrency="" - ARG test - ARG allow_fail=false - LOCALLY - # Let docker compose know about the pushed tags above - ENV AZTEC_DOCKER_TAG=$(git rev-parse HEAD) - # Optimize to not cause serial behavior if image already exists - IF ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" - WAIT - BUILD ../+export-end-to-end - END - END - RUN docker run -e HARDWARE_CONCURRENCY=$hardware_concurrency --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $test || $allow_fail - -E2E_TEST_PUBLIC_TESTNET: - FUNCTION - ARG hardware_concurrency="" - ARG test - ARG allow_fail=false - ARG seq_private_key - ARG prover_private_key - ARG ethereum_host - ARG l1_chain_id - LOCALLY - # Let docker compose know about the pushed tags above - ENV AZTEC_DOCKER_TAG=$(git rev-parse HEAD) - # Optimize to not cause serial behavior if image already exists - IF ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" - WAIT - BUILD ../+export-end-to-end - END - END - RUN docker run -e L1_CHAIN_ID=$l1_chain_id -e ETHEREUM_HOST=$ethereum_host -e SEQ_PUBLISHER_PRIVATE_KEY=$seq_private_key -e PROVER_PUBLISHER_PRIVATE_KEY=$prover_private_key -e HARDWARE_CONCURRENCY=$hardware_concurrency --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $test || $allow_fail - -NETWORK_TEST: - FUNCTION - ARG values_file="default.yaml" - ARG namespace - ARG test - ARG chaos_values - ARG fresh_install - ARG force_build - LOCALLY - # Let docker compose know about the pushed tags above - ENV AZTEC_DOCKER_TAG=$(git rev-parse HEAD) - IF [ "$force_build" = "true" ] || \ - ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ - ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" - WAIT - BUILD ../+export-e2e-test-images - END - END - # load the docker image into kind - RUN kind load docker-image aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG - RUN kind load docker-image aztecprotocol/aztec:$AZTEC_DOCKER_TAG - - # if fresh_install is true, delete the namespace - IF [ "$fresh_install" = "true" ] - RUN kubectl delete namespace $namespace --ignore-not-found=true --wait=true --now --timeout=10m - END - - RUN helm install spartan ../../spartan/aztec-network/ \ - --namespace $namespace \ - --create-namespace \ - --values ../../spartan/aztec-network/values/$values_file \ - --set images.test.image="aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" \ - --set images.aztec.image="aztecprotocol/aztec:$AZTEC_DOCKER_TAG" \ - --set test="$test" \ - --wait \ - --wait-for-jobs=true \ - --timeout=10m - - RUN kubectl wait pod -l app==pxe --for=condition=Ready -n $namespace --timeout=10m - - RUN helm test spartan --namespace $namespace --timeout 30m - e2e-p2p: - DO +E2E_TEST --test=./src/e2e_p2p_network.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_p2p_network.test.ts e2e-l1-with-wall-time: - DO +E2E_TEST --test=./src/e2e_l1_with_wall_time.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_l1_with_wall_time.test.ts e2e-2-pxes: - DO +E2E_TEST --test=./src/e2e_2_pxes.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_2_pxes.test.ts e2e-nft: - DO +E2E_TEST --test=./src/e2e_nft.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_nft.test.ts e2e-prover-full: - DO +E2E_TEST --test=./src/e2e_prover/full --hardware_concurrency=${HARDWARE_CONCURRENCY:-32} + LOCALLY + RUN HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} ./scripts/e2e_test.sh ./src/e2e_prover/full e2e-prover-with-padding: - DO +E2E_TEST --test=./src/e2e_prover/with_padding --hardware_concurrency=${HARDWARE_CONCURRENCY:-32} + LOCALLY + RUN HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} ./scripts/e2e_test.sh ./src/e2e_prover/with_padding e2e-account-contracts: - DO +E2E_TEST --test=./src/e2e_account_contracts.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_account_contracts.test.ts e2e-authwit: - DO +E2E_TEST --test=./src/e2e_authwit.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_authwit.test.ts e2e-avm-simulator: - DO +E2E_TEST --test=./src/e2e_avm_simulator.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_avm_simulator.test.ts e2e-blacklist-token-contract: - DO +E2E_TEST --test=./src/e2e_blacklist_token_contract + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_blacklist_token_contract e2e-block-building: - DO +E2E_TEST --test=./src/e2e_block_building.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_block_building.test.ts e2e-bot: - DO +E2E_TEST --test=./src/e2e_bot.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_bot.test.ts e2e-card-game: - DO +E2E_TEST --test=./src/e2e_card_game.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_card_game.test.ts e2e-cheat-codes: - DO +E2E_TEST --test=./src/e2e_cheat_codes.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_cheat_codes.test.ts e2e-crowdfunding-and-claim: - DO +E2E_TEST --test=./src/e2e_crowdfunding_and_claim.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_crowdfunding_and_claim.test.ts e2e-delegate-calls: - DO +E2E_TEST --test=./src/e2e_delegate_calls + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_delegate_calls e2e-deploy-contract: - DO +E2E_TEST --test=./src/e2e_deploy_contract + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_deploy_contract e2e-encryption: - DO +E2E_TEST --test=./src/e2e_encryption.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_encryption.test.ts e2e-escrow-contract: - DO +E2E_TEST --test=./src/e2e_escrow_contract.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_escrow_contract.test.ts e2e-keys: - DO +E2E_TEST --test=./src/e2e_keys.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_keys.test.ts e2e-lending-contract: - DO +E2E_TEST --test=./src/e2e_lending_contract.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_lending_contract.test.ts e2e-max-block-number: - DO +E2E_TEST --test=./src/e2e_max_block_number.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_max_block_number.test.ts e2e-multiple-accounts-1-enc-key: - DO +E2E_TEST --test=./src/e2e_multiple_accounts_1_enc_key.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_multiple_accounts_1_enc_key.test.ts e2e-nested-contract: - DO +E2E_TEST --test=./src/e2e_nested_contract + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_nested_contract e2e-non-contract-account: - DO +E2E_TEST --test=./src/e2e_non_contract_account.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_non_contract_account.test.ts e2e-note-getter: - DO +E2E_TEST --test=./src/e2e_note_getter.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_note_getter.test.ts e2e-ordering: - DO +E2E_TEST --test=./src/e2e_ordering.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_ordering.test.ts e2e-outbox: - DO +E2E_TEST --test=./src/e2e_outbox.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_outbox.test.ts e2e-pending-note-hashes-contract: - DO +E2E_TEST --test=./src/e2e_pending_note_hashes_contract.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_pending_note_hashes_contract.test.ts e2e-private-voting-contract: - DO +E2E_TEST --test=./src/e2e_private_voting_contract.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_private_voting_contract.test.ts e2e-prover-node: - DO +E2E_TEST --test=./src/e2e_prover_node.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_prover_node.test.ts e2e-fees-private-payments: - DO +E2E_TEST --test=./src/e2e_fees/private_payments.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/private_payments.test.ts e2e-fees-private-refunds: - DO +E2E_TEST --test=./src/e2e_fees/private_refunds.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/private_refunds.test.ts e2e-fees-gas-estimation: - DO +E2E_TEST --test=./src/e2e_fees/gas_estimation.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/gas_estimation.test.ts e2e-fees-dapp-subscription: - DO +E2E_TEST --test=./src/e2e_fees/dapp_subscription.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/dapp_subscription.test.ts e2e-fees-failures: - DO +E2E_TEST --test=./src/e2e_fees/failures.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/failures.test.ts e2e-fees-fee-juice-payments: - DO +E2E_TEST --test=./src/e2e_fees/fee_juice_payments.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/fee_juice_payments.test.ts e2e-fees-account-init: - DO +E2E_TEST --test=./src/e2e_fees/account_init.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_fees/account_init.test.ts e2e-cross-chain-messaging: - DO +E2E_TEST --test=./src/e2e_cross_chain_messaging + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_cross_chain_messaging e2e-state-vars: - DO +E2E_TEST --test=./src/e2e_state_vars.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_state_vars.test.ts e2e-logs: - DO +E2E_TEST --test=./src/e2e_event_logs.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_event_logs.test.ts e2e-static-calls: - DO +E2E_TEST --test=./src/e2e_static_calls.test.ts + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_static_calls.test.ts e2e-token-contract: - DO +E2E_TEST --test=./src/e2e_token_contract + LOCALLY + RUN ./scripts/e2e_test.sh ./src/e2e_token_contract e2e-public-testnet: ARG L1_CHAIN_ID="31337" + # automatically exported as ENV variables for below ARG ETHEREUM_HOST ARG SEQ_PUBLISHER_PRIVATE_KEY ARG PROVER_PUBLISHER_PRIVATE_KEY - DO +E2E_TEST_PUBLIC_TESTNET --test=./src/public-testnet --seq_private_key=${SEQ_PUBLISHER_PRIVATE_KEY:-} --prover_private_key=${PROVER_PUBLISHER_PRIVATE_KEY:-} --ethereum_host=${ETHEREUM_HOST:-} --l1_chain_id=${L1_CHAIN_ID:-} + LOCALLY + RUN ./scripts/e2e_test_public_testnet.sh ./src/public-testnet flakey-e2e-tests: - DO +E2E_TEST --test=./src/flakey --allow_fail=true + LOCALLY + RUN ./scripts/e2e_test.sh ./src/flakey || true e2e-sandbox-example: - DO +E2E_COMPOSE_TEST --test=e2e_sandbox_example.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh e2e_sandbox_example.test.ts uniswap-trade-on-l1-from-l2: - DO +E2E_COMPOSE_TEST --test=uniswap_trade_on_l1_from_l2.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh uniswap_trade_on_l1_from_l2.test.ts integration-l1-publisher: - DO +E2E_COMPOSE_TEST --test=integration_l1_publisher.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh integration_l1_publisher.test.ts # Disabled, TODO https://github.com/AztecProtocol/aztec-packages/issues/6624 # integration-proof-verification: -# DO +E2E_COMPOSE_TEST --compose_file=./scripts/docker-compose-no-sandbox.yml --test=integration_proof_verification.test.ts +# LOCALLY +# RUN COMPOSE_FILE=./scripts/docker-compose-no-sandbox.yml ./scripts/e2e_compose_test.sh integration_proof_verification.test.ts e2e-browser: - DO +E2E_COMPOSE_TEST --test=e2e_aztec_js_browser.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh e2e_aztec_js_browser.test.ts pxe: - DO +E2E_COMPOSE_TEST --test=pxe.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh pxe.test.ts e2e-docs-examples: - DO +E2E_COMPOSE_TEST --test=docs_examples.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh docs_examples.test.ts guides-writing-an-account-contract: - DO +E2E_COMPOSE_TEST --test=guides/writing_an_account_contract.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh guides/writing_an_account_contract.test.ts guides-dapp-testing: - DO +E2E_COMPOSE_TEST --test=guides/dapp_testing.test.ts + LOCALLY + RUN ./scripts/e2e_compose_test.sh guides/dapp_testing.test.ts # TODO intermittent failure # guides-sample-dapp: -# DO +E2E_COMPOSE_TEST --test=sample-dapp +# LOCALLY +# RUN ./scripts/e2e_compose_test.sh sample-dapp # TODO currently hangs for hour+ # guides-up-quick-start: -# DO +E2E_COMPOSE_TEST --test=guides/up_quick_start.test.ts +# LOCALLY +# RUN ./scripts/e2e_compose_test.sh guides/up_quick_start.test.ts bench-publish-rollup: - ARG PULL_REQUEST - ARG BRANCH - ARG COMMIT_HASH - DO +E2E_COMPOSE_TEST --test=benchmarks/bench_publish_rollup.test.ts --debug="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" --compose_file=./scripts/docker-compose-no-sandbox.yml + LOCALLY + ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml + ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} + # redundant, but just to be explicit: + ENV PULL_REQUEST=$PULL_REQUEST + ENV BRANCH=$BRANCH + ENV COMMIT_HASH=$COMMIT_HASH + RUN ./scripts/e2e_compose_test.sh benchmarks/bench_publish_rollup.test.ts DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH bench-process-history: - ARG PULL_REQUEST - ARG BRANCH - ARG COMMIT_HASH - DO +E2E_COMPOSE_TEST --test=benchmarks/bench_process_history.test.ts --debug="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" --compose_file=./scripts/docker-compose-no-sandbox.yml + LOCALLY + ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml + ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} + # redundant, but just to be explicit: + ENV PULL_REQUEST=$PULL_REQUEST + ENV BRANCH=$BRANCH + ENV COMMIT_HASH=$COMMIT_HASH + RUN ./scripts/e2e_compose_test.sh benchmarks/bench_process_history.test.ts DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH bench-tx-size: - ARG PULL_REQUEST - ARG BRANCH - ARG COMMIT_HASH - DO +E2E_COMPOSE_TEST --test=benchmarks/bench_tx_size_fees.test.ts --debug="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" --enable_gas=1 --compose_file=./scripts/docker-compose-no-sandbox.yml + LOCALLY + ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml + ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} + # redundant, but just to be explicit: + ENV PULL_REQUEST=$PULL_REQUEST + ENV BRANCH=$BRANCH + ENV COMMIT_HASH=$COMMIT_HASH + RUN ./scripts/e2e_compose_test.sh benchmarks/bench_tx_size_fees.test.ts DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH bench-prover: - ARG PULL_REQUEST - ARG BRANCH - ARG COMMIT_HASH - DO +E2E_COMPOSE_TEST --test=bench_prover --debug="aztec:benchmarks:*,aztec:prover*,aztec:bb*,aztec:pxe*" --enable_gas=1 --compose_file=./scripts/docker-compose-no-sandbox.yml --hardware_concurrency=${HARDWARE_CONCURRENCY:-32} + LOCALLY + ENV COMPOSE_FILE=scripts/docker-compose-no-sandbox.yml + ENV DEBUG="aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees" + ENV HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-32} + # redundant, but just to be explicit: + ENV PULL_REQUEST=$PULL_REQUEST + ENV BRANCH=$BRANCH + ENV COMMIT_HASH=$COMMIT_HASH + RUN ./scripts/e2e_compose_test.sh bench_prover DO ../../+UPLOAD_LOGS --PULL_REQUEST=$PULL_REQUEST --BRANCH=$BRANCH --COMMIT_HASH=$COMMIT_HASH e2e-devnet-smoke: - DO +E2E_COMPOSE_TEST --test=devnet/e2e_smoke.test.ts --compose_file=scripts/docker-compose-devnet.yml + LOCALLY + RUN COMPOSE_FILE=scripts/docker-compose-devnet.yml ./scripts/e2e_compose_test.sh devnet/e2e_smoke.test.ts e2e-cli-wallet: - DO +E2E_COMPOSE_TEST --test=e2e_cli_wallet --compose_file=scripts/docker-compose-wallet.yml + LOCALLY + RUN COMPOSE_FILE=scripts/docker-compose-wallet.yml ./scripts/e2e_compose_test.sh e2e_cli_wallet network-smoke: - ARG force_build - ARG values_file="default.yaml" - DO +NETWORK_TEST --test=./src/spartan/smoke.test.ts --namespace=smoke --fresh_install=true --force_build=$force_build --values_file=$values_file + LOCALLY + RUN NAMESPACE=smoke FRESH_INSTALL=true FORCE_BUILD=$force_build VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/smoke.test.ts network-transfer: - ARG force_build - ARG values_file="default.yaml" - DO +NETWORK_TEST --test=./src/spartan/transfer.test.ts --namespace=transfer --fresh_install=true --force_build=$force_build --values_file=$values_file + LOCALLY + RUN NAMESPACE=transfer FRESH_INSTALL=true FORCE_BUILD=$force_build VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/transfer.test.ts diff --git a/yarn-project/end-to-end/scripts/build_images.sh b/yarn-project/end-to-end/scripts/build_images.sh old mode 100644 new mode 100755 diff --git a/yarn-project/end-to-end/scripts/e2e_compose_test.sh b/yarn-project/end-to-end/scripts/e2e_compose_test.sh new file mode 100755 index 00000000000..c82338c9b8b --- /dev/null +++ b/yarn-project/end-to-end/scripts/e2e_compose_test.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Usage: ./e2e_compose_test.sh +# Optional environment variables: +# COMPOSE_FILE (default: ./scripts/docker-compose.yml) +# DEBUG (default: "aztec:*") +# HARDWARE_CONCURRENCY (default: "") +# ENABLE_GAS (default: "") +# AZTEC_DOCKER_TAG (default: current git commit) + +set -eu + +# Note: We export variables to make them available to the docker compose file + +# Main positional parameter +export TEST="$1" +# Variables with defaults +COMPOSE_FILE="${COMPOSE_FILE:-./scripts/docker-compose.yml}" +export DEBUG="${DEBUG:-aztec:*}" +export HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" +export AZTEC_DOCKER_TAG="${AZTEC_DOCKER_TAG:-$(git rev-parse HEAD)}" +FORCE_BUILD="${FORCE_BUILD:-true}" + +# Compute project_name +export JOB_NAME=$(echo "$TEST" | sed 's/\./_/g' | sed 's/\//_/g') + +# Determine CMD +if docker compose > /dev/null 2>&1; then + CMD="docker compose" +else + CMD="docker-compose" +fi + +# Optimize image building +if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ + ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then + echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-test-images' or otherwise tagged with aztecprotocol/aztec:$AZTEC_DOCKER_TAG and aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." + exit 1 +fi + +# Run docker compose +$CMD -p "$JOB_NAME" -f "$COMPOSE_FILE" up --exit-code-from=end-to-end --force-recreate diff --git a/yarn-project/end-to-end/scripts/e2e_test.sh b/yarn-project/end-to-end/scripts/e2e_test.sh new file mode 100755 index 00000000000..5faec984d16 --- /dev/null +++ b/yarn-project/end-to-end/scripts/e2e_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Usage: ./e2e_test.sh +# Optional environment variables: +# HARDWARE_CONCURRENCY (default: "") + +set -eu + +# Main positional parameter +TEST="$1" +# Default values for environment variables +HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" +AZTEC_DOCKER_TAG=$(git rev-parse HEAD) + +if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then + echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-end-to-end' or otherwise tagged with aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." + exit 1 +fi + +docker run -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG "$TEST" diff --git a/yarn-project/end-to-end/scripts/e2e_test_public_testnet.sh b/yarn-project/end-to-end/scripts/e2e_test_public_testnet.sh new file mode 100755 index 00000000000..6516d089cba --- /dev/null +++ b/yarn-project/end-to-end/scripts/e2e_test_public_testnet.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Usage: ./e2e_test_public_testnet.sh +# Optional environment variables: +# SEQ_PUBLISHER_PRIVATE_KEY +# PROVER_PUBLISHER_PRIVATE_KEY +# ETHEREUM_HOST +# HARDWARE_CONCURRENCY (default: "") +# ALLOW_FAIL (default: false) +# L1_CHAIN_ID (default: "31337") +# AZTEC_DOCKER_TAG (default: current git commit) + +set -eu + +# Main positional parameter +TEST="$1" + +# Variables with defaults +HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" +L1_CHAIN_ID="${L1_CHAIN_ID:-31337}" +AZTEC_DOCKER_TAG="${AZTEC_DOCKER_TAG:-$(git rev-parse HEAD)}" + +# Check if the image exists +if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then + echo "Building end-to-end Docker image..." + echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-end-to-end' or otherwise tagged with aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." + exit 1 +fi + +# Run the test +docker run \ + -e L1_CHAIN_ID="$L1_CHAIN_ID" \ + -e ETHEREUM_HOST="${ETHEREUM_HOST:-}" \ + -e SEQ_PUBLISHER_PRIVATE_KEY="${SEQ_PUBLISHER_PRIVATE_KEY:-}" \ + -e PROVER_PUBLISHER_PRIVATE_KEY="${PROVER_PUBLISHER_PRIVATE_KEY:-}" \ + -e HARDWARE_CONCURRENCY="$HARDWARE_CONCURRENCY" \ + --rm aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG "$TEST" diff --git a/yarn-project/end-to-end/scripts/network_test.sh b/yarn-project/end-to-end/scripts/network_test.sh new file mode 100755 index 00000000000..77f92f0b14e --- /dev/null +++ b/yarn-project/end-to-end/scripts/network_test.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Usage: ./network_test.sh +# Required environment variables: +# NAMESPACE +# Optional environment variables: +# VALUES_FILE (default: "default.yaml") +# CHAOS_VALUES (default: "") +# FRESH_INSTALL (default: "false") +# AZTEC_DOCKER_TAG (default: current git commit) + +set -eu + +# Main positional parameter +TEST="$1" + +# Default values for environment variables +VALUES_FILE="${VALUES_FILE:-default.yaml}" +CHAOS_VALUES="${CHAOS_VALUES:-}" +FRESH_INSTALL="${FRESH_INSTALL:-false}" +AZTEC_DOCKER_TAG=${AZTEC_DOCKER_TAG:-$(git rev-parse HEAD)} + +# Check required environment variable +if [ -z "${NAMESPACE:-}" ]; then + echo "Environment variable NAMESPACE is required." + exit 1 +fi + +if ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/aztec:$AZTEC_DOCKER_TAG" || \ + ! docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG"; then + echo "Docker images not found. They need to be built with 'earthly ./yarn-project/+export-test-images' or otherwise tagged with aztecprotocol/aztec:$AZTEC_DOCKER_TAG and aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG." + exit 1 +fi + +# Load the Docker images into kind +kind load docker-image aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG +kind load docker-image aztecprotocol/aztec:$AZTEC_DOCKER_TAG + +# If FRESH_INSTALL is true, delete the namespace +if [ "$FRESH_INSTALL" = "true" ]; then + kubectl delete namespace "$NAMESPACE" --ignore-not-found=true --wait=true --now --timeout=10m +fi + +# Install the Helm chart +helm install spartan spartan/aztec-network/ \ + --namespace "$NAMESPACE" \ + --create-namespace \ + --values "$(git rev-parse --show-toplevel)/spartan/aztec-network/values/$VALUES_FILE" \ + --set images.test.image="aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" \ + --set images.aztec.image="aztecprotocol/aztec:$AZTEC_DOCKER_TAG" \ + --set test="$TEST" \ + --wait \ + --wait-for-jobs=true \ + --timeout=10m + +kubectl wait pod -l app==pxe --for=condition=Ready -n "$NAMESPACE" --timeout=10m + +helm test spartan --namespace "$NAMESPACE" --timeout 30m