Skip to content

tests: integration speedups - #9794

Open
daywalker90 wants to merge 21 commits into
ElementsProject:masterfrom
daywalker90:tests/integration-speedups
Open

daywalker90 wants to merge 21 commits into
ElementsProject:masterfrom
daywalker90:tests/integration-speedups

Conversation

@daywalker90

Copy link
Copy Markdown
Collaborator

Changelog-None

@nGoline nGoline left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for splitting this out. Most of the sleeps are replaced by waits on the right thing. Two of the new wait_for conditions are already true before the event the old sleep covered, so they don't wait for what they say, and the rune rate windows got too tight to survive valgrind. Inline.

Comment thread tests/test_pay.py Resolved
Comment thread tests/test_currencyrate.py Resolved
Comment thread tests/test_runes.py Resolved
Add --developer options --dev-htlc-offer-timeout-secs (default 30),
--dev-plugin-startup-timeout-secs (default 120), and
--dev-stable-connection-secs (default 60) so integration tests can
exercise these timers without long wall-clock sleeps, leaving production
defaults unchanged.
…ves.py

check_coin_moves() iterated over enumerate(expected_moves) (so
isinstance(m, list) was always False) and compared expected_count
against all accounts' moves rather than account_id's moves, triggering
an unconditional 5-second sleep on nearly every call. Count per-account
moves properly and poll with wait_for(..., timeout=10) only when lagging.

In test_coinmoves.py, wait for 'onchaind complete, forgetting peer'
before checking final moves instead of sleeping 5 seconds six times.
…cing tests

Ten time.sleep(5) calls in test_splicing.py and test_splicing_disconnect.py
waited to check either that no unilateral close tx was recorded in
channeltxs (only written during chaintopology block processing) or that
channel_funding_inflights cleared.

Replace them with sync_blockheight(bitcoind, [l1, l2]) and wait_for(),
saving ~50s across splicing tests while making the checks deterministic.
- Add --dev-bkpr-currencyrate-tolerance (defaulting to 60s) in bookkeeper
  so test_bkpr_currencyrate_warns_for_old_events can test stale-event
  warning without two 61s sleeps (~116s saved), and wait for the Unix
  second to advance past inv2 before paying inv3 so inv2's 1s cached
  rate does not cover inv3.
- In test_bkpr_currencyrate_persisted, l1.restart() already clears
  cln-currencyrate's cache, so sleep(1) suffices for a new timestamp
  instead of sleep(61) (~60s saved, matching test_bkpr_currencyrate_ranges).
- In test_bkpr_listaccountevents_realtime, wait_for() the datastore entry
  instead of a blind sleep(10) (~9.5s saved).
- In test_currencyrate_rounding, test all three sources on one node
  instead of starting three nodes sequentially, and lower fake_rateserver
  slow_delay from 1s to 0.2s.
- In `test_createrune`, use `rate=6` (10s) and `rate=3` (20s) instead of
  `rate=3` (20s) and `rate=1` (60s), leaving ~10s of margin for RPCs
  under Valgrind, and use a 3s (8s under Valgrind) expiry for `rune3`
  instead of 15s (~69s saved).
- In `test_createrune_per_restriction`, check all five 2s per-unit runes
  across a single 2.2s sleep instead of five sequential 3s sleeps, and
  verify `per=1min` stays rate-limited after 2.2s instead of sleeping
  61s (~75s saved).
…t_behaviors

test_lsps2_mock_transport_behaviors was parametrized across 8 transport
configs, starting a fresh bitcoind and two lightningd nodes for each case
only to call lsps2-mock-configure and lsps0.list_protocols. Run all 8
cases sequentially on a single node pair (lsps2-mock-configure replaces
the config), cutting ~7 node-pair startups/teardowns with identical
coverage.
In notifications_received_via_websocket(), sio.connect() already
completes the Socket.IO namespace handshake before returning, so remove
the 2s pre-RPC sleep and replace the 2s post-RPC sleep with wait_for()
on the expected notification key. Also drop the two 2s sleeps in
test_websocket_upgrade_header() where sio.connect() already failed.
- Replace time.sleep(5) with wait_for() on listforwards() in
  test_forward_local_failed_stats and wait_for_logs() on
  dev_ignore_htlcs in test_htlcs_cltv_only_difference.
- Use timeout=2 instead of 10 for the intentional timeout check in
  test_fetchinvoice.
- Use shorter recurrence/expiry/enforcedelay windows (scaling up on
  VALGRIND or SLOW_MACHINE) in test_fetchinvoice_recurrence,
  test_recurrence_expired_offer, test_recurring_currency_invoice_refresh,
  and test_setchannel_enforcement_delay, while still checking 1minutes
  recurrence parsing and next_period calculation.
Add an open_channels() helper that funds all channels in one sendmany
transaction and confirms/announces them in a single block batch, and
replace sequential join_nodes() loops in test_xpay_limited_max_accepted_htlcs,
test_xpay_unknown_next_peer_excludes_node, setup_failing_hub,
test_xpay_maxparts, and test_xpay_maxparts_unannounced_retry (waiting
for l2 to sync l1's public channels via gossip before creating the
unannounced invoice so listincoming includes the routehint). Also use
retry_for=2 instead of 10 for the intentional timeout check in
test_xpay_blockheight_mismatch.
Scale invoice expiry durations down on fast machines (keeping larger
margins under VALGRIND or SLOW_MACHINE) in test_invoice_expiry and
test_expiry_startup_crash, and verify the invoice status is expired
after restart in test_expiry_startup_crash.
Use shorter autoclean-cycle intervals on non-Valgrind runs in
test_autoclean and test_autoclean_batch, poll more frequently in
test_autoclean, and sleep 4s instead of 20s (with an explicit getinfo
liveness check) in test_autoclean_timer_crash.
- Use --dev-htlc-offer-timeout-secs in test_htlc_failed_noclose instead
  of sleeping 35 seconds.
- Synchronize mock_donothing with a threading.Event in
  test_fundee_node_unconfirmed instead of sleeping 10 seconds.
Use node_factory.get_nodes() instead of starting peers sequentially,
and pass allow_bad_gossip=True on peers since l1 closes all four
announced channels before peers finish receiving each other's
channel_announcements.
Use the existing start_channels() helper in test_mpp, test_errors, and
test_limits instead of pairs of sequential join_nodes() calls, and
deduplicate nodes in start_channels().
Wait only until the clock passes after_12 + 1 instead of sleeping 10
seconds unconditionally between creating the two channels.
Both cln-currencyrate and tests/plugins/currencyUSDAUD5000.py register
the currencyconvert RPC method at manifest time. Match test_offer,
test_fetchinvoice, and test_recurring_currency_invoice_refresh by
passing disable-plugin=cln-currencyrate in
test_fetchinvoice_invoice_expiry and test_xpay_currency_offer to avoid
a startup duplicate-method race.
Mark the remaining 7 high-memory tests not covered by ElementsProject#9787
(`test_onchain_multihtlc_our_unilateral`,
`test_onchain_multihtlc_their_unilateral`,
`test_funding_v2_cancel_race`, `test_payerkey`,
`test_commando_stress`, `test_xpay_fee_insufficient_bias`, and
`test_xpay_fee_insufficient_disable`) with
`@pytest.mark.xdist_group("heavy")` so they serialize on one worker
under ASan/UBSan.
Pass --dev-plugin-startup-timeout-secs (10s, or 30s under Valgrind) in
test_plugin_slowinit, test_plugin_command, test_failing_plugins, and
test_plugin_startdir_lol, and --dev-stable-connection-secs (25s under
Valgrind, 10s on SLOW_MACHINE, 5s otherwise) in
test_last_stable_connection.
In test_reservations_leak_under_load, 300 concurrent HTLCs across 6
Valgrind nodes on a 4-vCPU runner can briefly exceed connectd's 5s
wake-delay threshold; allow the 'connectd: wake delay for' log under
VALGRIND.
…ttle

Pass --dev-gossip-cpu-budget=500000 under VALGRIND so Valgrind's ~20x
CPU overhead does not blow the 1500usec dev CPU budget and stall out4
past connectd's ping timeout, while keeping the 1000-byte/s traffic
throttle active.
In test_splice_upgrade_with_pending_splice, connect and wait for
WIRE_CHANNEL_REESTABLISH on both l1 and l2 before calling
bitcoind.generate_block(6), matching
test_splice_reconnect_after_lock_no_channel_ready.

Under Valgrind, l1's reconnect could take longer than block generation,
causing l2 to process all 6 blocks while channeld was detached and never
send WIRE_SPLICE_LOCKED after reconnecting.
@daywalker90
daywalker90 force-pushed the tests/integration-speedups branch from d6ba749 to a26da34 Compare December 1, 2026 16:07
@daywalker90
daywalker90 requested a review from nGoline December 1, 2026 16:11

This branch has not been deployed

No deployments
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