Skip to content

Commit 4ad8367

Browse files
committed
disable auto-caching for test
1 parent 7f77193 commit 4ad8367

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

services/director/src/simcore_service_director/registry_proxy.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ async def list_image_tags_gen(
318318
tags, headers = await registry_request(
319319
app, path=path, method="GET", use_cache=not update_cache
320320
) # initial call
321+
assert "tags" in tags # nosec
321322
while True:
322323
if "Link" in headers:
323324
next_path = (
@@ -331,11 +332,15 @@ async def list_image_tags_gen(
331332
else:
332333
prefetch_task = None
333334

334-
yield list(
335-
filter(
336-
VERSION_REG.match,
337-
tags["tags"],
335+
yield (
336+
list(
337+
filter(
338+
VERSION_REG.match,
339+
tags["tags"],
340+
)
338341
)
342+
if tags["tags"] is not None
343+
else []
339344
)
340345
if prefetch_task:
341346
tags, headers = await prefetch_task

services/director/tests/unit/test_registry_proxy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import asyncio
55
import json
66
import time
7+
from unittest import mock
78

89
import pytest
910
from fastapi import FastAPI
1011
from pytest_benchmark.plugin import BenchmarkFixture
12+
from pytest_mock.plugin import MockerFixture
1113
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
1214
from pytest_simcore.helpers.typing_env import EnvVarsDict
1315
from settings_library.docker_registry import RegistrySettings
@@ -228,9 +230,17 @@ def configure_registry_caching(
228230
)
229231

230232

233+
@pytest.fixture
234+
def with_disabled_auto_caching(mocker: MockerFixture) -> mock.Mock:
235+
return mocker.patch(
236+
"simcore_service_director.registry_proxy._list_all_services_task", autospec=True
237+
)
238+
239+
231240
async def test_registry_caching(
232241
configure_registry_access: EnvVarsDict,
233242
configure_registry_caching: EnvVarsDict,
243+
with_disabled_auto_caching: mock.Mock,
234244
app_settings: ApplicationSettings,
235245
app: FastAPI,
236246
push_services,

0 commit comments

Comments
 (0)