Skip to content

fix: route broker.publish through fake client in TestOutboxBroker#9

Merged
lesnik512 merged 1 commit into
mainfrom
fix/test-broker-publish-routes-to-fake-client
May 21, 2026
Merged

fix: route broker.publish through fake client in TestOutboxBroker#9
lesnik512 merged 1 commit into
mainfrom
fix/test-broker-publish-routes-to-fake-client

Conversation

@lesnik512
Copy link
Copy Markdown
Member

broker.publish / publish_batch / cancel_timer inside TestOutboxBroker previously went through SQLAlchemy session.execute, bypassing the patched FakeOutboxClient — the row landed in the real DB while subscriber loops polled the in-memory fake, so handlers never fired. Patch all three methods in _patch_broker to route to the fake; session becomes optional in test mode, matching FastStream's standard test-broker idiom.

`broker.publish` / `publish_batch` / `cancel_timer` inside `TestOutboxBroker`
previously went through SQLAlchemy `session.execute`, bypassing the patched
`FakeOutboxClient` — the row landed in the real DB while subscriber loops
polled the in-memory fake, so handlers never fired. Patch all three methods
in `_patch_broker` to route to the fake; `session` becomes optional in test
mode, matching FastStream's standard test-broker idiom.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this May 21, 2026
@lesnik512 lesnik512 merged commit e9378b5 into main May 21, 2026
3 checks passed
@lesnik512 lesnik512 deleted the fix/test-broker-publish-routes-to-fake-client branch May 21, 2026 05:49
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.

1 participant