From 815c4fbe944dcd7fc1f3238d2e16086d469d7bf9 Mon Sep 17 00:00:00 2001 From: Jan Nanista Date: Sun, 26 Jan 2025 18:35:44 -0800 Subject: [PATCH] chore: Add a stub of an E2E test --- .../tests/assets/kurtosis_args_isthmus.yaml | 20 +++++++++++ test/e2e/tests/isthmus.bats | 33 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/e2e/tests/assets/kurtosis_args_isthmus.yaml create mode 100644 test/e2e/tests/isthmus.bats diff --git a/test/e2e/tests/assets/kurtosis_args_isthmus.yaml b/test/e2e/tests/assets/kurtosis_args_isthmus.yaml new file mode 100644 index 0000000..a9e89e5 --- /dev/null +++ b/test/e2e/tests/assets/kurtosis_args_isthmus.yaml @@ -0,0 +1,20 @@ +ethereum_package: + participants: + - el_type: reth + cl_type: lighthouse +optimism_package: + op_contract_deployer_params: + image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.11 + chains: + - network_params: + isthmus_time_offset: 0 + participants: + - el_type: op-geth + el_image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest + cl_type: op-node + cl_image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:develop + cl_extra_params: + - "--l1.trustrpc=true" + batcher_params: + extra_params: + - "--throttle-interval=0" diff --git a/test/e2e/tests/isthmus.bats b/test/e2e/tests/isthmus.bats new file mode 100644 index 0000000..2135f07 --- /dev/null +++ b/test/e2e/tests/isthmus.bats @@ -0,0 +1,33 @@ +setup() { + load "../lib/bats-support/load.bash" + load "../lib/bats-assert/load.bash" +} + +teardown() { + +} + +@test "should have isthmus time if isthmus_time_offset is configured" { + local ENCLAVE_ID=op-isthmus--001 + + # First we start the enclave + run kurtosis run --enclave $ENCLAVE_ID . --args-file test/e2e/tests/assets/kurtosis_args_isthmus.yaml + assert_success + + # We get the UUID of the op-geth service + local OP_GETH_SERVICE_UUID=$(kurtosis enclave inspect $ENCLAVE_ID --full-uuids| grep op-el-1-op-geth-op-node-op-kurtosis | awk '{print $1;}') + assert [ -n "$OP_GETH_SERVICE_UUID" ] + + # Now we find its RPC URL + local OP_GETH_RPC_URL=$(kurtosis service inspect $ENCLAVE_ID $OP_GETH_SERVICE_UUID | grep ' rpc:' | awk '{print $4;}') + assert [ -n "$OP_GETH_RPC_URL" ] + + # We ask the RPC for the node info + local OP_GETH_NODE_INFO_JSON=$(curl -s -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}' $OP_GETH_RPC_URL) + + # And finally we find the isthmusTime and make sure it's defined + local OP_GETH_ISTHMUS_TIME=$(jq '.result.protocols.eth.config.isthmusTime' <<< $OP_GETH_NODE_INFO_JSON) + assert_equal "$OP_GETH_ISTHMUS_TIME" "0" + + kurtosis enclave rm -f $ENCLAVE_ID +} \ No newline at end of file