Skip to content

Commit

Permalink
feat: e2e tests with kurtosis (#47)
Browse files Browse the repository at this point in the history
Adds github workflow which launches kurtosis and runs (for now 2 simple)
tests against running network.

This is for now patched to use my repo for optimism-package until we
have paradigmxyz/optimism-package#4 merged.

Here's example workflow run
https://github.com/klkvr/odyssey/actions/runs/11372561760/job/31637163326

I wasn't able to make docker caching work so right now it takes ~30m,
I'm wondering if there are some easy optimizations we could do?
  • Loading branch information
klkvr authored Oct 17, 2024
1 parent 7c11c28 commit d922f5e
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 514 deletions.
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
serial-integration = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'package(odyssey-testing)'
filter = 'package(odyssey-e2e-tests)'
test-group = 'serial-integration'
59 changes: 59 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Runs E2E tests against Kurtosis.

name: e2e

on:
pull_request:
merge_group:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install Kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
- name: Clone optimism-package
run: |
git clone https://github.com/klkvr/optimism-package
cd optimism-package
git switch odyssey
- name: Build Odyssey
run: docker buildx build . --load -t ghcr.io/ithacaxyz/odyssey:latest
- name: Run enclave
id: kurtosis
run: |
kurtosis engine start
kurtosis run --enclave op-devnet ./optimism-package --args-file ./etc/kurtosis.yaml
ENCLAVE_ID=$(curl http://127.0.0.1:9779/api/enclaves | jq --raw-output 'keys[0]')
SEQUENCER_EL_PORT=$(curl "http://127.0.0.1:9779/api/enclaves/$ENCLAVE_ID/services" | jq '."op-el-1-op-reth-op-node".public_ports.rpc.number')
REPLICA_EL_PORT=$(curl "http://127.0.0.1:9779/api/enclaves/$ENCLAVE_ID/services" | jq '."op-el-2-op-reth-op-node".public_ports.rpc.number')
echo "SEQUENCER_RPC=http://127.0.0.1:$SEQUENCER_EL_PORT" >> $GITHUB_ENV
echo "REPLICA_RPC=http://127.0.0.1:$REPLICA_EL_PORT" >> $GITHUB_ENV
- name: Run E2E tests
run: |
cargo nextest run \
--locked \
--workspace \
-E "package(odyssey-e2e-tests)"
2 changes: 1 addition & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cargo nextest run \
--locked \
--workspace \
-E "kind(lib) | kind(bin) | kind(proc-macro)"
-E "(kind(lib) | kind(bin) | kind(proc-macro)) & !package(odyssey-e2e-tests)"
doc:
name: doc tests
Expand Down
Loading

0 comments on commit d922f5e

Please sign in to comment.