Skip to content

Commit

Permalink
disable auto-caching for test
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Nov 25, 2024
1 parent 7f77193 commit 4ad8367
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 9 additions & 4 deletions services/director/src/simcore_service_director/registry_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ async def list_image_tags_gen(
tags, headers = await registry_request(
app, path=path, method="GET", use_cache=not update_cache
) # initial call
assert "tags" in tags # nosec
while True:
if "Link" in headers:
next_path = (
Expand All @@ -331,11 +332,15 @@ async def list_image_tags_gen(
else:
prefetch_task = None

yield list(
filter(
VERSION_REG.match,
tags["tags"],
yield (
list(
filter(
VERSION_REG.match,
tags["tags"],
)
)
if tags["tags"] is not None
else []
)
if prefetch_task:
tags, headers = await prefetch_task
Expand Down
10 changes: 10 additions & 0 deletions services/director/tests/unit/test_registry_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import asyncio
import json
import time
from unittest import mock

import pytest
from fastapi import FastAPI
from pytest_benchmark.plugin import BenchmarkFixture
from pytest_mock.plugin import MockerFixture
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
from pytest_simcore.helpers.typing_env import EnvVarsDict
from settings_library.docker_registry import RegistrySettings
Expand Down Expand Up @@ -228,9 +230,17 @@ def configure_registry_caching(
)


@pytest.fixture
def with_disabled_auto_caching(mocker: MockerFixture) -> mock.Mock:
return mocker.patch(
"simcore_service_director.registry_proxy._list_all_services_task", autospec=True
)


async def test_registry_caching(
configure_registry_access: EnvVarsDict,
configure_registry_caching: EnvVarsDict,
with_disabled_auto_caching: mock.Mock,
app_settings: ApplicationSettings,
app: FastAPI,
push_services,
Expand Down

0 comments on commit 4ad8367

Please sign in to comment.