alby-hub/transactions
Roland 0b0cbbd985
fix: make event assertions in tests wait for async event consumption (#2531)
The mock event consumer waited a fixed 10ms before returning consumed
events, which was not always enough on slow CI runners and caused flaky
failures (e.g. TestMarkSettled_App_BudgetWarning missing its
nwc_budget_warning event). It also appended to the events slice from
concurrent goroutines without synchronization, a data race that could
drop events.

- guard the consumed events slice with a mutex and return copies
- add WaitForConsumedEvents which polls until the expected number of
  events arrived (up to 5s) instead of relying on a fixed sleep
- use it in tests that assert on consumed events; tests asserting that
  no event was published keep the short grace period
- normalize event order in the keysend self-payment test, matching the
  existing approach in the self-payment test, since async publishing
  does not guarantee ordering

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 14:48:41 +07:00
..
app_payments_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
check_unsettled_transaction_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
hold_invoice_self_payment_consumer.go fix: intercept self hold payments based on invoice rather than payment hash (#2027) 2026-02-27 10:22:24 +05:30
isolated_app_payments_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
keysend_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
list_transactions_test.go feat: filter transactions (#2464) 2026-08-07 10:52:14 +07:00
lookup_transaction_test.go feat: PostgreSQL support (#922) 2025-01-16 17:17:24 +07:00
make_invoice_test.go fix: add validation on MakeInvoice for zero and non-whole satoshi amounts (#2413) 2026-06-09 13:25:36 +07:00
notifications_test.go feat: filter transactions (#2464) 2026-08-07 10:52:14 +07:00
payments_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
receive_keysend_test.go chore: update to use sat/msat suffixes everywhere (#2271) 2026-05-01 15:41:56 +05:30
self_hold_payments_test.go chore: update to use sat/msat suffixes everywhere (#2271) 2026-05-01 15:41:56 +05:30
self_payment_detection_test.go feat: bark backend (#2374) 2026-06-04 11:57:29 +07:00
self_payments_test.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
transactions_service.go fix: publish transaction events only after the database transaction commits (#2520) 2026-08-08 13:38:28 +07:00
user_labels_test.go feat: user labels for transactions (#2265) 2026-04-30 13:13:07 +02:00