File tree Expand file tree Collapse file tree
tests/unit/manager/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import pytest
1111import sqlalchemy as sa
1212
13+ from ai .backend .common .container_registry import ContainerRegistryType
1314from ai .backend .common .data .endpoint .types import EndpointLifecycle
1415from ai .backend .common .types import (
1516 AutoScalingMetricComparator ,
@@ -226,13 +227,23 @@ async def test_image(
226227 db_with_cleanup : ExtendedAsyncSAEngine ,
227228 ) -> AsyncGenerator [ImageRow , None ]:
228229 """Create test image."""
230+ registry_id = uuid .uuid4 ()
229231 async with db_with_cleanup .begin_session () as db_sess :
232+ db_sess .add (
233+ ContainerRegistryRow (
234+ id = registry_id ,
235+ url = "https://docker.io" ,
236+ registry_name = f"reg-{ uuid .uuid4 ().hex [:8 ]} " ,
237+ type = ContainerRegistryType .DOCKER ,
238+ )
239+ )
240+ await db_sess .flush ()
230241 image = ImageRow (
231242 name = "test-image:latest" ,
232243 project = str (uuid .uuid4 ()),
233244 image = "test-image" ,
234245 registry = "docker.io" ,
235- registry_id = uuid . uuid4 () ,
246+ registry_id = registry_id ,
236247 architecture = "x86_64" ,
237248 is_local = False ,
238249 config_digest = "sha256:abc123" ,
Original file line number Diff line number Diff line change 1111import sqlalchemy as sa
1212
1313from ai .backend .common .config import ModelDefinitionDraft
14+ from ai .backend .common .container_registry import ContainerRegistryType
1415from ai .backend .common .data .endpoint .types import EndpointLifecycle
1516from ai .backend .common .identifier .vfolder import VFolderUUID
1617from ai .backend .common .types import (
@@ -244,13 +245,23 @@ async def test_image(
244245 db_with_cleanup : ExtendedAsyncSAEngine ,
245246 ) -> AsyncGenerator [ImageRow , None ]:
246247 """Create test image."""
248+ registry_id = uuid .uuid4 ()
247249 async with db_with_cleanup .begin_session () as db_sess :
250+ db_sess .add (
251+ ContainerRegistryRow (
252+ id = registry_id ,
253+ url = "https://docker.io" ,
254+ registry_name = f"reg-{ uuid .uuid4 ().hex [:8 ]} " ,
255+ type = ContainerRegistryType .DOCKER ,
256+ )
257+ )
258+ await db_sess .flush ()
248259 image = ImageRow (
249260 name = "test-image:latest" ,
250261 project = str (uuid .uuid4 ()),
251262 image = "test-image" ,
252263 registry = "docker.io" ,
253- registry_id = uuid . uuid4 () ,
264+ registry_id = registry_id ,
254265 architecture = "x86_64" ,
255266 is_local = False ,
256267 config_digest = "sha256:abc123" ,
You can’t perform that action at this time.
0 commit comments