Skip to content

Fix flaky localnet e2e tests - #128

Merged
gregnazario merged 1 commit into
mainfrom
greg/e2e-test-reliability-1489
Aug 13, 2026
Merged

Fix flaky localnet e2e tests#128
gregnazario merged 1 commit into
mainfrom
greg/e2e-test-reliability-1489

Conversation

@gregnazario

Copy link
Copy Markdown
Contributor

Description

Localnet CI has been red since early August because examples.read_aggregator assumed APT CoinInfo.supply is always a table-backed aggregator. Recent localnets store that supply as OptionalAggregator.integer instead:

aggregator not found in data: {'supply': {'vec': [{'aggregator': {'vec': []}, 'integer': {'vec': [{'value': '43510', ...}]}}]}}

This also hardens the e2e path against the historical flakes from #31 (faucet SEQUENCE_NUMBER_TOO_OLD and indexer lag).

Changes:

  • RestClient.aggregator_value reads either OptionalAggregator variant (aggregator table or integer) and no longer mutates the path list.
  • REST GETs/idempotent POSTs and faucet mint calls retry 429/5xx/transport errors; faucet also retries sequence-number races and serializes concurrent fund_account calls on the same client.
  • RestClient.wait_until_ready polls ledger info so integration tests wait out localnet startup.
  • Integration harness reloads example network config after setting env vars, and sets APTOS_INDEXER_URL=none (the previous APTOS_INDEXER_CLIENT env var was ignored).
  • Sequential same-account faucet funding in large_package_publisher; longer indexer poll in transfer_coin.

Test Plan

  • make lint
  • make test (unit tests + behave specs)
  • New unit tests for integer OptionalAggregator, HTTP 503 retry, faucet SEQUENCE_NUMBER_TOO_OLD retry, and wait_until_ready
  • Localnet Tests workflow on this PR (make integration_test / make examples)

Related Links

Open in Web Open in Cursor 

Localnet Tests have been failing because Aptos Coin supply on recent
localnets is an OptionalAggregator integer, not a table-backed aggregator.
Also retry transient REST/faucet errors (including SEQUENCE_NUMBER_TOO_OLD)
and make the example harness wait for the node and pick up localnet env vars.

Co-authored-by: Greg Nazario <greg@gnazar.io>
@gregnazario
gregnazario marked this pull request as ready for review August 13, 2026 03:10
@gregnazario
gregnazario requested a review from a team as a code owner August 13, 2026 03:10
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.77528% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.07%. Comparing base (0831ae0) to head (0e7f3d1).

Files with missing lines Patch % Lines
aptos_sdk/async_client.py 79.77% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #128      +/-   ##
==========================================
- Coverage   93.20%   93.07%   -0.14%     
==========================================
  Files          56       56              
  Lines        5183     5239      +56     
==========================================
+ Hits         4831     4876      +45     
- Misses        352      363      +11     
Flag Coverage Δ *Carryforward flag
v1-sdk 90.17% <79.77%> (-0.19%) ⬇️
v2-sdk 97.02% <ø> (ø) Carriedforward from 0831ae0

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
aptos_sdk/async_client.py 90.20% <79.77%> (-1.67%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gregnazario
gregnazario merged commit ddb1ff2 into main Aug 13, 2026
11 checks passed
@gregnazario
gregnazario deleted the greg/e2e-test-reliability-1489 branch August 13, 2026 16:04
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