mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/usestrix/strix.git
synced 2026-09-20 08:03:42 +08:00
fix(runtime): stage extra-file bind mounts under the temp dir so remote docker daemons can resolve them
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -18,6 +19,7 @@ from strix.runtime.session_manager import (
|
||||
build_extra_file_bind_mounts,
|
||||
build_extra_file_entries,
|
||||
build_manifest_entries,
|
||||
extra_file_staging_dir,
|
||||
)
|
||||
|
||||
|
||||
@@ -319,6 +321,21 @@ def test_extra_file_bind_mounts_avoid_basename_collisions(tmp_path: Path) -> Non
|
||||
assert mounts[0]["source"] != mounts[1]["source"]
|
||||
|
||||
|
||||
def test_extra_file_staging_lives_under_the_temp_dir_not_the_run_dir() -> None:
|
||||
staging = extra_file_staging_dir("clients-release-evisort-dev_86b7")
|
||||
|
||||
assert staging.is_dir()
|
||||
assert staging.is_relative_to(Path(tempfile.gettempdir()))
|
||||
assert "strix_runs" not in staging.parts
|
||||
|
||||
|
||||
def test_extra_file_staging_dir_sanitizes_the_scan_id() -> None:
|
||||
staging = extra_file_staging_dir("../weird id/../")
|
||||
|
||||
assert staging.is_dir()
|
||||
assert staging.is_relative_to(Path(tempfile.gettempdir()))
|
||||
|
||||
|
||||
def test_only_bind_mount_capable_backends_are_registered_as_such() -> None:
|
||||
assert backend_supports_bind_mounts("docker")
|
||||
assert not backend_supports_bind_mounts("e2b")
|
||||
|
||||
Reference in New Issue
Block a user