⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt` 가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는 시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음. - `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침** - `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시) - 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q` 옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0 ⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""storage/가 링크(정션)일 때 업로드 경로 기준이 어긋나지 않는지.
|
|
|
|
워크트리를 나눠 쓰면 `storage/`가 본 폴더로 가는 정션이다. 저장 엔진은
|
|
`Path.resolve()`로 링크를 따라가는데 프로젝트 루트가 링크 경로 그대로면
|
|
`chunk_path.relative_to(project_root)`가 ValueError로 터졌다(2026-08-30 실사고).
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
|
|
def test_resolve_stored_project_path_follows_storage_link(tmp_path, monkeypatch):
|
|
real_storage = tmp_path / "real" / "storage"
|
|
(real_storage / "1" / "3" / "proj").mkdir(parents=True)
|
|
link_storage = tmp_path / "work" / "storage"
|
|
link_storage.parent.mkdir(parents=True)
|
|
try:
|
|
os.symlink(real_storage, link_storage, target_is_directory=True)
|
|
except (OSError, NotImplementedError) as exc: # 권한 없으면 검사 불가
|
|
pytest.skip(f"심볼릭 링크를 만들 수 없음: {exc}")
|
|
|
|
import common_util.common_util_storage as storage
|
|
|
|
monkeypatch.setattr(storage, "STORAGE_BASE_DIR", str(link_storage))
|
|
resolved = Path(storage.resolve_stored_project_path("storage/1/3/proj"))
|
|
|
|
# 저장 엔진이 쓰는 기준(resolve)과 같은 경로여야 한다
|
|
assert resolved == resolved.resolve()
|
|
# 그래야 엔진이 만든 하위 경로를 프로젝트 루트 기준 상대경로로 뺄 수 있다
|
|
chunk = (resolved / "B03_FileInput" / "chunks_temp" / "s1" / "00000000.chunk").resolve()
|
|
assert chunk.relative_to(resolved).as_posix().startswith("B03_FileInput/")
|