Feat/test broker sync dispatch#10
Merged
Merged
Conversation
`TestOutboxBroker` now matches the FastStream test-broker idiom — `await broker.publish(...)` synchronously drives the matching subscriber's consume pipeline before returning, the same model as `TestKafkaBroker` / `TestRabbitBroker`. No more background polling, no more `_wait_until` in tests. Mechanics: - Extracted the per-row body of `OutboxSubscriber._worker_loop` into a public `dispatch_one(row)` so both the loop and the test broker share one code path. - `fake_publish` / `fake_publish_batch` now feed the fake client, acquire the row's lease in place, and `await dispatch_one(msg)`. Future-dated rows (`activate_in` / `activate_at`) intentionally skip sync dispatch — they sit in the fake client, mirroring production where they wait for the gate. - Added a `fake_fetch_unprocessed` shim so `broker.fetch_unprocessed` reads the in-memory store in test mode. - `TestOutboxBroker(broker, run_loops=True)` is the opt-in escape hatch that restores the previous loop-driven behavior; required for tests that exercise retry rescheduling, lease-expiry reclaim, or fetch-loop error recovery. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… guard Adds a sync-mode test that exercises ``_find_subscriber_for_queue``'s ``if not sub.calls: continue`` branch by publishing to a queue whose only subscriber has no registered handler — the row stays in the fake client. Marks the ``_fetch_loop``'s defensive ``client is None`` guard as ``pragma: no cover``: it only triggers during a teardown race (``broker_config.client`` reset to None before the loop's ``while self.running`` next-iteration check) that's hard to deterministically hit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.