-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Redirecting labels request via catalog in director-v2 (#7016)
Co-authored-by: Andrei Neagu <neagu@itis.swiss>
- Loading branch information
Showing
27 changed files
with
303 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.6.0 | ||
0.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
services/catalog/src/simcore_service_catalog/api/rest/_services_labels.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from typing import Annotated, Any | ||
|
||
from fastapi import APIRouter, Depends | ||
from models_library.services import ServiceKey, ServiceVersion | ||
|
||
from ...services.director import DirectorApi | ||
from ..dependencies.director import get_director_api | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/{service_key:path}/{service_version}/labels") | ||
async def get_service_labels( | ||
service_key: ServiceKey, | ||
service_version: ServiceVersion, | ||
director_client: Annotated[DirectorApi, Depends(get_director_api)], | ||
) -> dict[str, Any]: | ||
return await director_client.get_service_labels(service_key, service_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# pylint: disable=redefined-outer-name | ||
# pylint: disable=unused-argument | ||
|
||
from collections.abc import Callable | ||
from unittest.mock import AsyncMock | ||
|
||
import pytest | ||
from fastapi import FastAPI | ||
from httpx import AsyncClient | ||
from respx import MockRouter | ||
|
||
|
||
@pytest.fixture | ||
def mock_engine(app: FastAPI) -> None: | ||
app.state.engine = AsyncMock() | ||
|
||
|
||
async def test_get_service_labels( | ||
postgres_setup_disabled: None, | ||
mocked_director_service_api: MockRouter, | ||
rabbitmq_and_rpc_setup_disabled: None, | ||
background_tasks_setup_disabled: None, | ||
mock_engine: None, | ||
get_mocked_service_labels: Callable[[str, str], dict], | ||
aclient: AsyncClient, | ||
): | ||
service_key = "simcore/services/comp/ans-model" | ||
service_version = "3.0.0" | ||
result = await aclient.get(f"/v0/services/{service_key}/{service_version}/labels") | ||
assert result.status_code == 200, result.text | ||
assert result.json() == get_mocked_service_labels(service_key, service_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.