Build 060.28: implement Persistent Checkpoint and Startup Recovery
This commit is contained in:
@@ -37,7 +37,10 @@ class RecordingJournal:
|
||||
del event, message, context
|
||||
|
||||
|
||||
def make_settings() -> SimpleNamespace:
|
||||
def make_settings(
|
||||
*,
|
||||
storage_enabled: bool = True,
|
||||
) -> SimpleNamespace:
|
||||
return SimpleNamespace(
|
||||
bot_token="test-token",
|
||||
bot_parse_mode="HTML",
|
||||
@@ -46,7 +49,9 @@ def make_settings() -> SimpleNamespace:
|
||||
exchange_name="dzengi",
|
||||
default_symbol="BTC/USD_LEVERAGE",
|
||||
trade_stream=SimpleNamespace(enabled=True),
|
||||
market_data_storage=SimpleNamespace(enabled=True),
|
||||
market_data_storage=SimpleNamespace(
|
||||
enabled=storage_enabled,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -59,9 +64,11 @@ def test_create_app_builds_one_application_composition(
|
||||
runtime = object()
|
||||
storage_lifecycle = object()
|
||||
storage_sink = object()
|
||||
storage_repository = object()
|
||||
storage = SimpleNamespace(
|
||||
lifecycle=storage_lifecycle,
|
||||
trade_observation_sink=storage_sink,
|
||||
trade_repository=storage_repository,
|
||||
)
|
||||
journal = RecordingJournal()
|
||||
observed_runtime_settings: list[object] = []
|
||||
@@ -103,9 +110,11 @@ def test_create_app_builds_one_application_composition(
|
||||
received_settings: object,
|
||||
*,
|
||||
trade_observation_sink: object,
|
||||
checkpoint_storage: object,
|
||||
) -> object:
|
||||
observed_runtime_settings.append(received_settings)
|
||||
assert trade_observation_sink is storage_sink
|
||||
assert checkpoint_storage is storage_repository
|
||||
return runtime
|
||||
|
||||
monkeypatch.setattr(
|
||||
@@ -162,7 +171,7 @@ def test_runtime_build_error_is_fatal(
|
||||
monkeypatch.setattr(
|
||||
app_factory,
|
||||
"load_settings",
|
||||
make_settings,
|
||||
lambda: make_settings(storage_enabled=False),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
app_factory,
|
||||
@@ -189,8 +198,11 @@ def test_runtime_build_error_is_fatal(
|
||||
settings: object,
|
||||
*,
|
||||
trade_observation_sink: object,
|
||||
checkpoint_storage: object,
|
||||
) -> None:
|
||||
del settings, trade_observation_sink
|
||||
del settings
|
||||
assert trade_observation_sink is None
|
||||
assert checkpoint_storage is None
|
||||
raise expected
|
||||
|
||||
monkeypatch.setattr(
|
||||
|
||||
Reference in New Issue
Block a user