Skip to content

Commit db33358

Browse files
committed
Add missing add_task test for sandbox_mounts + keep_mounts_for_sandbox=True
Raised in review of PR #1350: the add_task path had no test for the highest-priority rule — sandbox_mounts must win even when keep_mounts_for_sandbox=True. Without it, that regression could slip through while the declarative path stays green. Signed-off-by: suriya <sgunasekar@nvidia.com>
1 parent 9266e61 commit db33358

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/test_pipeline_utils.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,3 +671,36 @@ def test_add_task_no_sandbox_mounts_falls_back_to_empty(mock_port, mock_get_exec
671671

672672
sandbox_mounts = mock_get_executor.call_args_list[-1].kwargs["mounts"]
673673
assert sandbox_mounts == []
674+
675+
676+
@patch("nemo_skills.pipeline.utils.exp.get_executor")
677+
@patch("nemo_skills.pipeline.utils.exp.get_free_port", return_value=12345)
678+
def test_add_task_sandbox_mounts_takes_precedence_over_keep_mounts_for_sandbox_true(mock_port, mock_get_executor):
679+
"""add_task: sandbox_mounts wins even when keep_mounts_for_sandbox=True."""
680+
from types import SimpleNamespace
681+
682+
from nemo_skills.pipeline.utils.exp import add_task
683+
684+
mock_get_executor.return_value = MagicMock()
685+
exp = SimpleNamespace(add=MagicMock(return_value="task_handle"))
686+
cluster_config = {
687+
"executor": "local",
688+
"containers": {"sandbox": "sandbox:latest"},
689+
"sandbox_mounts": ["/host/data:/sandbox/data:ro"],
690+
}
691+
692+
add_task(
693+
exp=exp,
694+
cmd="echo hello",
695+
task_name="test-task",
696+
cluster_config=cluster_config,
697+
container="main:latest",
698+
log_dir="/tmp/logs",
699+
with_sandbox=True,
700+
keep_mounts_for_sandbox=True,
701+
skip_hf_home_check=True,
702+
reuse_code=False,
703+
)
704+
705+
sandbox_mounts = mock_get_executor.call_args_list[-1].kwargs["mounts"]
706+
assert sandbox_mounts == ["/host/data:/sandbox/data:ro"]

0 commit comments

Comments
 (0)