Skip to content

Fix e2e tests to actually run in CI#26

Merged
gregnazario merged 2 commits intomainfrom
cleanup-ci
Feb 6, 2026
Merged

Fix e2e tests to actually run in CI#26
gregnazario merged 2 commits intomainfrom
cleanup-ci

Conversation

@gregnazario
Copy link
Contributor

Summary

  • Fixed the core bug: The 26 e2e tests are all marked #[ignore] but the CI workflow and local script were missing -- --ignored, so tests were compiled but silently skipped every run
  • Improved e2e workflow robustness: localnet logs captured to file, printed on failure for debugging, explicit failure if localnet/faucet don't start in time
  • Fixed local script (scripts/run-e2e.sh): same -- --ignored fix, test filtering still works

Context

The #[ignore] attribute on e2e tests is intentional — it prevents them from accidentally running during cargo test --all-features in ci.yml (where no localnet is available). The e2e feature flag controls compilation, while #[ignore] controls runtime execution. The e2e workflow needs -- --ignored to opt in.

Test plan

  • E2E workflow should now actually execute all 26 ignored tests against localnet
  • ci.yml with --all-features should still skip e2e tests (no localnet)
  • ./scripts/run-e2e.sh runs tests locally with -- --ignored
  • ./scripts/run-e2e.sh account still filters correctly

The 26 e2e tests are all marked #[ignore] (needed to prevent them from
running during `cargo test --all-features` in ci.yml where no localnet
is available), but the e2e workflow and local script were missing the
`-- --ignored` flag, so the tests were compiled but silently skipped.

Also improves the e2e workflow robustness:
- Capture localnet logs to a file for debugging
- Print logs on failure (similar to aptos-ts-sdk pattern)
- Fail explicitly if localnet or faucet don't start in time
- Clean up commented-out spec tests section
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug where 26 e2e tests were being compiled but never executed in CI due to missing the -- --ignored flag. The tests are intentionally marked with #[ignore] to prevent them from running during regular cargo test (where no localnet is available), but the e2e workflow and local script needed to explicitly opt-in with the -- --ignored flag.

Changes:

  • Added -- --ignored flag to e2e workflow and local test script to actually execute the ignored tests
  • Enhanced e2e workflow with better error handling: explicit timeouts, log capture to file, and failure debugging
  • Removed commented-out spec-tests-network job that was no longer needed

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/e2e.yml Added -- --ignored flag to cargo test command, improved localnet startup with timeout checks and log capture, enhanced cleanup and debugging
scripts/run-e2e.sh Added -- --ignored flag to cargo test commands for both default and filtered test execution
Comments suppressed due to low confidence (1)

scripts/run-e2e.sh:139

  • The run_tests function builds a shell command string containing untrusted TEST_FILTER data and executes it via eval, which allows shell command injection if an attacker can control the script argument. An input like "some_test; rm -rf /" would cause arbitrary commands to run with the privileges of the CI runner or developer invoking this script. To fix this, avoid using eval and instead invoke cargo test directly with properly quoted arguments (for example by using a Bash array so that the filter is passed as a single argument rather than interpolated into a command string).
    if [[ -n "$TEST_FILTER" ]]; then
        test_cmd="cargo test -p aptos-sdk --features 'e2e,full' -- --ignored $TEST_FILTER"
    fi
    
    echo "Running: $test_cmd"
    eval "$test_cmd"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The Aptos client was using chain_id 0 for custom network configurations
(including when APTOS_LOCAL_NODE_URL is set), causing BAD_CHAIN_ID errors
on all transaction submissions against localnet.

Add lazy chain_id resolution:
- Aptos struct now stores chain_id in RwLock, initialized from config
- ensure_chain_id() fetches from node when chain_id is unknown (0)
- build_transaction() resolves chain_id in parallel with seq num and gas
- ledger_info() updates chain_id as a side effect
- BatchOperations also resolves chain_id for custom networks

Fix e2e tests that manually build transactions to use ensure_chain_id()
instead of hardcoded chain_id values.
@gregnazario gregnazario merged commit b80ae9c into main Feb 6, 2026
14 checks passed
@gregnazario gregnazario deleted the cleanup-ci branch February 6, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants