Skip to content

Commit 4ce8251

Browse files
jopemachineclaude
andcommitted
test(BA-6041): MountOption.mount_destination is dropped on session creation but preserved on service creation
Two unit tests pinning the asymmetry the deprecation message describes: - ``AgentRegistry._mount_entries_from_creation_config`` ignores mount_destination inside ``mount_options``; only ``mount_id_map`` can supply destinations for session creation. - ``manager.data.model_serving.types.MountOption.from_dto`` carries mount_destination through to the data layer for the inference service creation flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f3bc9c9 commit 4ce8251

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/unit/manager/test_registry.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
ModelHealthCheck,
1919
ModelServiceConfig,
2020
)
21+
from ai.backend.common.dto.manager.session.types import MountOption as MountOptionDTO
2122
from ai.backend.common.events.event_types.session.broadcast import SchedulingBroadcastEvent
2223
from ai.backend.common.events.types import AbstractEvent
2324
from ai.backend.common.plugin.hook import HookPluginContext
@@ -28,6 +29,7 @@
2829
SlotName,
2930
)
3031
from ai.backend.manager.config.provider import ManagerConfigProvider
32+
from ai.backend.manager.data.model_serving.types import MountOption
3133
from ai.backend.manager.data.session.types import SessionStatus
3234
from ai.backend.manager.errors.kernel import SessionNotFound
3335
from ai.backend.manager.plugin.network import NetworkPluginContext
@@ -392,3 +394,40 @@ async def _hang(cache_id: str) -> AsyncIterator[AbstractEvent]:
392394
await mock_registry_obj._wait_for_session_running(
393395
session_id, mock_propagator, max_wait=0
394396
)
397+
398+
399+
class TestMountDestinationAsymmetry:
400+
"""``MountOption.mount_destination`` is honored only on the inference service
401+
creation path; session creation silently drops it from ``mount_options`` and
402+
pulls destinations from ``mount_id_map`` instead. This is why the field is
403+
marked deprecated for session callers (see common/dto/manager/session/types.py).
404+
"""
405+
406+
def test_session_creation_drops_mount_destination_from_mount_options(self) -> None:
407+
vfid = uuid.uuid4()
408+
creation_config = {
409+
"mount_ids": [vfid],
410+
"mount_id_map": {}, # caller did not provide a destination here
411+
"mount_options": {
412+
vfid: {"mount_destination": "/should/be/ignored", "permission": "ro"},
413+
},
414+
}
415+
416+
entries = AgentRegistry._mount_entries_from_creation_config(creation_config)
417+
418+
assert len(entries) == 1
419+
# mount_destination from mount_options is silently dropped — only
420+
# mount_id_map can supply destinations for session creation.
421+
assert entries[0].mount_destination is None
422+
423+
def test_inference_service_preserves_mount_destination_via_from_dto(self) -> None:
424+
dto = MountOptionDTO.model_validate({
425+
"mount_destination": "/models/extra",
426+
"perm": "ro",
427+
})
428+
429+
data = MountOption.from_dto(dto)
430+
431+
# Service-creation flow carries mount_destination through to the data
432+
# layer (and ultimately to VFolderMount.kernel_path).
433+
assert data.mount_destination == "/models/extra"

0 commit comments

Comments
 (0)