Description
Problem
Right now, coderdtest
uses a fake notifications enqueuer implementation that simply stores an internal list of enqueued notification messages.
The 'real' implementation actually stores enqueued notification messages in the database.
End result: integration tests end up not checking dbauthz
RBAC.
This is partially addressed in #15478 but the actual implemention is not 100% in line with reality.
Proposed solution
Our tests in coderd
should use the 'real' notifications.StoreEnqueuer
, and enqueued notifications should be stored in the configured database.Store
used by the tests.
However, there are some ergonomics considerations to be considered here, as tests will generally want to:
- Perform some action
- Wait for a notification to be enqueued asynchronously
- Perform assertions on the notification
Right now, we would need to resort to polling in order to accomplish this.
An option is to place a thin wrapper around notifications.StoreEnqueuer
that exposes the following methods to tests:
- Wait for a notification to be enqueued successfully
- Fetch all enqueued notifications
- Clear all enqueued notifications