test(472-6 6-A 시험 갈래): 서버를 AISLO_DESIGN_SAVE_FAIL_AFTER=<차례> 로 켜면 그 차례 뒤 일부러 실패 — 화면에서 실패 · 되돌림 확인용(평소 없음)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
@@ -23,7 +24,6 @@ from fastapi import APIRouter, Depends
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from common_util.common_util_auth import get_optional_session
|
||||
from B03_FileInput.B03_FileInput_Repository import get_project_storage_relative_path
|
||||
from B05_Profile.B05_Profile_Schema import (
|
||||
PageSettingsRequest,
|
||||
@@ -34,6 +34,7 @@ from B05_Profile.B05_Profile_Structures_Schema import StructureSaveRequest
|
||||
from B06_Section.B06_Section_Router_Stations import PlusStationsRequest
|
||||
from B06_Section.B06_Section_Schema import SectionConfirmRequest
|
||||
from common_util import common_util_save_guard as guard
|
||||
from common_util.common_util_auth import get_optional_session
|
||||
from common_util.common_util_storage import resolve_stored_project_path
|
||||
from config.config_db import get_db_pool
|
||||
|
||||
@@ -113,6 +114,9 @@ async def _run_steps(
|
||||
except Exception as error:
|
||||
logger.exception("한 본문 저장 %s 차례 실패: project_id=%s", name, project_id)
|
||||
raise StepFailed(name, str(error) or type(error).__name__) from None
|
||||
# 시험 갈래 — 화면에서 실패 · 되돌림을 돌려 볼 때만(서버를 이 환경 변수로 켬 · 평소 없음)
|
||||
if os.environ.get("AISLO_DESIGN_SAVE_FAIL_AFTER") == name:
|
||||
raise StepFailed(name, "시험 갈래 — 이 차례 뒤 일부러 실패")
|
||||
return out[name]
|
||||
|
||||
if request.settings is not None:
|
||||
|
||||
@@ -243,3 +243,12 @@ def test_같은_프로젝트_저장이_겹치면_뒤_요청이_기다림() -> No
|
||||
response = asyncio.run(run())
|
||||
body = json.loads(bytes(response.body).decode("utf-8"))
|
||||
assert body["status"] == "success" and body["waited"] is True and body["steps"] == {}
|
||||
|
||||
|
||||
@live
|
||||
def test_시험_갈래_환경_변수면_그_차례_뒤_실패_되돌림(monkeypatch) -> None:
|
||||
before = _state(ROOT_DIR)
|
||||
monkeypatch.setenv("AISLO_DESIGN_SAVE_FAIL_AFTER", "settings")
|
||||
status, body = _save(_request())
|
||||
assert status == 409 and body["step"] == "settings" and body["restored"] is True
|
||||
assert _state(ROOT_DIR) == before
|
||||
|
||||
Reference in New Issue
Block a user