alby-hub/tests
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
..
db Fix: sqlite connection parameters, add migrations to delete orphaned records and change postgres transaction amount to bigint (#1462) 2025-07-06 17:45:46 +07:00
mocks feat: stories (#2172) 2026-06-02 10:50:15 +02:00
create_app.go fix: update to alby go-nostr fork which reconnects after receiving CLOSED message (#2331) 2026-05-11 12:34:56 +07:00
create_mock_relay.go fix: update to alby go-nostr fork which reconnects after receiving CLOSED message (#2331) 2026-05-11 12:34:56 +07:00
mock_event_consumer.go fix: make event assertions in tests wait for async event consumption (#2531) 2026-08-11 14:48:41 +07:00
mock_ln_client.go fix: publish transaction events only after the database transaction commits (#2520) 2026-08-08 13:38:28 +07:00
test_service.go Feat: NWA auth for self-hosted hubs (#1016) 2025-02-27 19:12:55 +07:00