feat(music-lab): get_last_failed_step — 파이프라인 재개용 실패 step 판별
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
24
music-lab/tests/test_pipeline_retry.py
Normal file
24
music-lab/tests/test_pipeline_retry.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
from app import db
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fresh_db(monkeypatch, tmp_path):
|
||||
db_path = tmp_path / "music.db"
|
||||
monkeypatch.setattr(db, "DB_PATH", str(db_path))
|
||||
db.init_db()
|
||||
return db_path
|
||||
|
||||
|
||||
def test_get_last_failed_step_returns_step(fresh_db):
|
||||
pid = db.create_pipeline(track_id=1)
|
||||
job_id = db.create_pipeline_job(pid, "video")
|
||||
db.update_pipeline_job(job_id, status="failed", error="boom")
|
||||
db.update_pipeline_state(pid, "failed", failed_reason="video: boom")
|
||||
assert db.get_last_failed_step(pid) == "video"
|
||||
|
||||
|
||||
def test_get_last_failed_step_none_when_no_failure(fresh_db):
|
||||
pid = db.create_pipeline(track_id=1)
|
||||
db.create_pipeline_job(pid, "cover")
|
||||
assert db.get_last_failed_step(pid) is None
|
||||
Reference in New Issue
Block a user