Skip to content

Commit ffcab1b

Browse files
committed
tuning
1 parent c254218 commit ffcab1b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

services/web/server/tests/integration/01/test_garbage_collection.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from pytest_mock import MockerFixture
2828
from pytest_simcore.helpers.webserver_login import UserInfoDict, log_client_in
2929
from pytest_simcore.helpers.webserver_projects import create_project, empty_project_data
30+
from servicelib.aiohttp import status
3031
from servicelib.aiohttp.application import create_safe_application
3132
from settings_library.rabbit import RabbitSettings
3233
from settings_library.redis import RedisDatabase, RedisSettings
@@ -63,15 +64,16 @@
6364
log = logging.getLogger(__name__)
6465

6566
pytest_simcore_core_services_selection = [
66-
"migration",
67+
"migration", # NOTE: rebuild!
6768
"postgres",
6869
"rabbit",
6970
"redis",
70-
"storage",
71+
"storage", # NOTE: rebuild!
7172
]
7273
pytest_simcore_ops_services_selection = [
7374
"minio",
7475
"adminer",
76+
"redis-commander",
7577
]
7678

7779

@@ -98,11 +100,6 @@ async def _delete_all_redis_keys(redis_settings: RedisSettings):
98100
await client.aclose(close_connection_pool=True)
99101

100102

101-
@pytest.fixture(scope="session")
102-
def osparc_product_name() -> str:
103-
return "osparc"
104-
105-
106103
@pytest.fixture
107104
async def director_v2_service_mock(
108105
mocker: MockerFixture,
@@ -130,7 +127,7 @@ async def director_v2_service_mock(
130127
with aioresponses(passthrough=PASSTHROUGH_REQUESTS_PREFIXES) as mock:
131128
mock.get(
132129
get_computation_pattern,
133-
status=202,
130+
status=status.HTTP_202_ACCEPTED,
134131
payload={"state": str(RunningState.NOT_STARTED.value)},
135132
repeat=True,
136133
)
@@ -192,16 +189,19 @@ async def client(
192189
def disable_garbage_collector_task(mocker: MockerFixture) -> mock.MagicMock:
193190
"""patch the setup of the garbage collector so we can call it manually"""
194191

195-
async def _fake_background_task(app: web.Application):
196-
# startup
197-
await asyncio.sleep(0.1)
198-
yield
199-
# teardown
200-
await asyncio.sleep(0.1)
192+
def _fake_factory():
193+
async def _cleanup_ctx_fun(app: web.Application):
194+
# startup
195+
await asyncio.sleep(0.1)
196+
yield
197+
# teardown
198+
await asyncio.sleep(0.1)
199+
200+
return _cleanup_ctx_fun
201201

202202
return mocker.patch(
203203
"simcore_service_webserver.garbage_collector.plugin._tasks_core.create_background_task_for_garbage_collection",
204-
side_effect=_fake_background_task,
204+
side_effect=_fake_factory,
205205
)
206206

207207

services/web/server/tests/unit/isolated/test_garbage_collector_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def test_remove_orphaned_services_with_no_running_services_does_nothing(
124124
def faker_dynamic_service_get() -> Callable[[], DynamicServiceGet]:
125125
def _() -> DynamicServiceGet:
126126
return DynamicServiceGet.model_validate(
127-
DynamicServiceGet.model_config["json_schema_extra"]["examples"][1]
127+
DynamicServiceGet.model_json_schema()["examples"][1]
128128
)
129129

130130
return _

0 commit comments

Comments
 (0)