feat: sync execution with 3s progress polling (stage 2)
- pulp_client: get_repo / sync_repo / get_task (비동기 task href 반환)
- POST /repos/{uuid}/sync: remote 확인 후 동기화 시작, 진행률 조각 반환
- GET /repos/{uuid}/progress: progress_reports 합산 → 바/퍼센트,
완료/실패 시 hx-trigger 제거로 폴링 중단
- task_store: uuid→task_href 메모리 추적 (단일 인스턴스), 대시보드 '동기화 중' 집계
- views.task_progress: state/done/total/percent + created_resources에서 새 vN
- 동기화는 안전 동작이라 확인 모달 없이 실행 (스펙 §5-1)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,3 +70,34 @@ def test_summarize_counts():
|
||||
"gpg_pass": 2,
|
||||
"total_packages": 150,
|
||||
}
|
||||
|
||||
|
||||
def test_summarize_includes_syncing_count():
|
||||
assert views.summarize([], syncing=2)["syncing"] == 2
|
||||
|
||||
|
||||
def test_task_progress_running_sums_reports():
|
||||
task = {
|
||||
"state": "running",
|
||||
"progress_reports": [{"done": 5, "total": 10}, {"done": 3, "total": 10}],
|
||||
}
|
||||
p = views.task_progress(task)
|
||||
assert p["running"] is True
|
||||
assert p["completed"] is False
|
||||
assert (p["done"], p["total"], p["percent"]) == (8, 20, 40)
|
||||
|
||||
|
||||
def test_task_progress_completed_extracts_version():
|
||||
task = {
|
||||
"state": "completed",
|
||||
"created_resources": ["/pulp/api/v3/repositories/rpm/rpm/x/versions/4/"],
|
||||
}
|
||||
p = views.task_progress(task)
|
||||
assert p["completed"] is True
|
||||
assert p["new_version"] == 4
|
||||
|
||||
|
||||
def test_task_progress_failed_surfaces_error():
|
||||
p = views.task_progress({"state": "failed", "error": {"description": "boom"}})
|
||||
assert p["failed"] is True
|
||||
assert p["error"] == "boom"
|
||||
|
||||
Reference in New Issue
Block a user