Release SyncVito 1.0.12
This commit is contained in:
1 parent
ccb89191b5
commit
786e3ae9b3
8 files changed
+144
-8
No files matched your search
@@ -73,6 +73,30 @@ def test_retry_queues_all_ready_tasks(coordinator: SyncCoordinator, monkeypatch:
|
||||
monkeypatch.setattr(coordinator, "enqueue", queued.append)
|
||||
coordinator._check_retries()
|
||||
assert queued == ["first", "second"]
|
||||
assert "first" not in coordinator._retry_tasks
|
||||
assert "second" not in coordinator._retry_tasks
|
||||
|
||||
|
||||
def test_task_with_only_errors_is_not_queued_for_auto_retry(
|
||||
coordinator: SyncCoordinator, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
task = coordinator.config.tasks[0]
|
||||
coordinator._on_finished(task.id, SyncResult(errors=["Zugriff verweigert"]))
|
||||
assert task.id not in coordinator._retry_tasks
|
||||
queued = []
|
||||
monkeypatch.setattr(coordinator, "enqueue", queued.append)
|
||||
coordinator._check_retries()
|
||||
assert queued == []
|
||||
|
||||
|
||||
def test_retry_max_attempts_cap(coordinator: SyncCoordinator, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
task = coordinator.config.tasks[0]
|
||||
coordinator._retry_tasks[task.id] = []
|
||||
coordinator._retry_attempts[task.id] = 5
|
||||
queued = []
|
||||
monkeypatch.setattr(coordinator, "enqueue", queued.append)
|
||||
coordinator._check_retries()
|
||||
assert queued == []
|
||||
|
||||
|
||||
def test_start_resets_stale_progress_before_worker_starts(
|
||||
|
||||
@@ -269,3 +269,27 @@ def test_pause_and_resume_continues_where_interrupted(tmp_path: Path) -> None:
|
||||
assert (target / "a.txt").exists()
|
||||
assert (target / "b.txt").exists()
|
||||
assert (target / "c.txt").exists()
|
||||
|
||||
|
||||
def test_concurrently_deleted_source_file_is_skipped(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
source = tmp_path / "source"
|
||||
target = tmp_path / "target"
|
||||
source.mkdir()
|
||||
target.mkdir()
|
||||
(source / "ephemeral.txt").write_text("wird gelöscht")
|
||||
task = SyncTask(name="Transient", source=str(source), target=str(target))
|
||||
engine = _engine(tmp_path)
|
||||
|
||||
# Simuliere, dass die Datei kurz vor der Ausführung gelöscht wurde
|
||||
def delete_before_execute(operation, result):
|
||||
if operation.source and operation.source.name == "ephemeral.txt":
|
||||
operation.source.unlink(missing_ok=True)
|
||||
return SyncEngine._execute(operation, result)
|
||||
|
||||
monkeypatch.setattr(engine, "_execute", delete_before_execute)
|
||||
result = engine.synchronize(task)
|
||||
|
||||
assert result.successful
|
||||
assert result.skipped == 1
|
||||
assert not result.errors
|
||||
assert not (target / "ephemeral.txt").exists()
|
||||
Reference in new issue
Block a user