Skip to content

Integration test: EventBridge Redis pub/sub round-trip #2405

@berendt

Description

@berendt

Part of #2400. Follow-up to #2368.

What

Cover the cross-container event path in osism/services/event_bridge.py. EventBridge.add_event() publishes JSON to the Redis osism:events channel (event_bridge.py:89); a second EventBridge subscribes in a background thread (_redis_subscriber_loop, :154) and forwards decoded events to its websocket manager. This mechanism is currently untested and depends only on Redis.

Scope

  • A publisher EventBridge.add_event(type, payload) results in the message arriving on the osism:events channel — assert via a raw redis.pubsub() subscriber, or a second EventBridge with a fake websocket manager that records _process_single_event.
  • Round-trip payload integrity (event_type + payload survive JSON encode/decode).
  • publish to a channel with no subscribers is handled (logged warning, no crash).

Notes / Where

New file tests/integration/test_event_bridge.py. Use a fake/stub websocket manager (records calls) to avoid pulling in FastAPI here. Account for the background subscriber thread: poll with a timeout for the event to arrive, and tear down the bridge (_shutdown_event) at the end so threads do not leak between tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions