Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lite_bootstrap/bootstrappers/faststream_bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ def __init__(
) -> None: ...


def _make_asgi_faststream() -> "AsgiFastStream":
return AsgiFastStream()


@dataclasses.dataclass(kw_only=True, slots=True, frozen=True)
class FastStreamConfig(
HealthChecksConfig, LoggingConfig, OpentelemetryConfig, PrometheusConfig, PyroscopeConfig, SentryConfig
):
application: "AsgiFastStream" = dataclasses.field(default_factory=AsgiFastStream)
application: "AsgiFastStream" = dataclasses.field(default_factory=_make_asgi_faststream)
opentelemetry_middleware_cls: type[FastStreamTelemetryMiddlewareProtocol] | None = None
prometheus_middleware_cls: type[FastStreamPrometheusMiddlewareProtocol] | None = None

Expand Down
5 changes: 5 additions & 0 deletions tests/test_faststream_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ async def test_faststream_bootstrap_health_check_wo_broker() -> None:
bootstrapper.teardown()


def test_faststream_config_default_application() -> None:
config = FastStreamConfig()
assert isinstance(config.application, faststream.asgi.AsgiFastStream)


def test_faststream_bootstrapper_not_ready() -> None:
with emulate_package_missing("faststream"), pytest.raises(RuntimeError, match="faststream is not installed"):
FastStreamBootstrapper(bootstrap_config=FastStreamConfig(application=faststream.asgi.AsgiFastStream()))
Expand Down
Loading