Skip to content

Commit c718176

Browse files
fix
1 parent bb25608 commit c718176

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

services/storage/tests/conftest.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def app_settings(
219219
enabled_rabbitmq: RabbitSettings,
220220
sqlalchemy_async_engine: AsyncEngine,
221221
postgres_host_config: dict[str, str],
222-
mocked_s3_server_envs: EnvVarsDict,
223222
datcore_adapter_service_mock: respx.MockRouter,
224223
mocked_redis_server: None,
224+
mocked_s3_server_envs: EnvVarsDict, # Moved to end to ensure S3_ENDPOINT override happens last
225225
) -> ApplicationSettings:
226226
test_app_settings = ApplicationSettings.create_from_envs()
227227
print(f"{test_app_settings.model_dump_json(indent=2)=}")
@@ -1009,34 +1009,26 @@ def _(celery_app: Celery) -> None: ...
10091009

10101010
@pytest.fixture
10111011
def app_server_factory_with_worker_mode(
1012-
enable_tracing,
10131012
app_environment: EnvVarsDict,
1014-
enabled_rabbitmq: RabbitSettings,
1015-
sqlalchemy_async_engine: AsyncEngine,
1016-
postgres_host_config: dict[str, str],
1017-
mocked_s3_server_envs: EnvVarsDict,
1018-
datcore_adapter_service_mock: respx.MockRouter,
1019-
mocked_redis_server: None,
1020-
mock_celery_app: Celery,
10211013
monkeypatch: pytest.MonkeyPatch,
10221014
) -> Callable[[], FastAPIAppServer]:
1023-
with monkeypatch.context() as patch:
1024-
patch.setenv("STORAGE_WORKER_MODE", "true")
1025-
patch.setenv("CELERY_POOL", "threads")
1015+
monkeypatch.setenv("STORAGE_WORKER_MODE", "true")
10261016

1027-
# Create settings with worker mode enabled
1028-
worker_mode_app_settings = ApplicationSettings.create_from_envs()
1017+
def _app_server_factory() -> FastAPIAppServer:
1018+
app_settings = ApplicationSettings.create_from_envs()
10291019

1030-
def _app_server_factory() -> FastAPIAppServer:
1031-
tracing_config = TracingConfig.create(
1032-
tracing_settings=None, # disable tracing in tests
1033-
service_name="storage-api",
1034-
)
1035-
return FastAPIAppServer(
1036-
app=create_app(worker_mode_app_settings, tracing_config)
1037-
)
1020+
# Verify that worker mode is actually enabled
1021+
assert app_settings.STORAGE_WORKER_MODE is True
1022+
1023+
print(f"Worker: {app_settings.model_dump_json(indent=2)=}")
1024+
1025+
tracing_config = TracingConfig.create(
1026+
tracing_settings=None, # disable tracing in tests
1027+
service_name="storage-api",
1028+
)
1029+
return FastAPIAppServer(app=create_app(app_settings, tracing_config))
10381030

1039-
return _app_server_factory
1031+
return _app_server_factory
10401032

10411033

10421034
@pytest.fixture

0 commit comments

Comments
 (0)