Слияние: Defer отклоняет catched, снято мёртвое ребро (T3)
This commit is contained in:
@@ -1008,6 +1008,25 @@ func TestDefer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Defer из пре-источникового catched отклоняется конфликтом: торрент ещё не
|
||||
// добавлен в qBittorrent, откладывать нечего, а catched → deferred увёл бы
|
||||
// задачу в лимбо → необратимый deleted (MAJOR-6). Состояние не меняется.
|
||||
func TestDeferRejectsCatched(t *testing.T) {
|
||||
st := newMemStore()
|
||||
d := completedDownload("1")
|
||||
d.State = store.StateCatched
|
||||
st.put(d)
|
||||
w := testWorkerWith(st, &fakeQbt{}, &fakeRecognizer{}, nil)
|
||||
|
||||
err := w.Defer(context.Background(), "1")
|
||||
if !errors.Is(err, ErrConflict) {
|
||||
t.Fatalf("Defer from catched = %v, want ErrConflict", err)
|
||||
}
|
||||
if st.downloads["1"].State != store.StateCatched {
|
||||
t.Errorf("state = %q, want catched (не тронуто)", st.downloads["1"].State)
|
||||
}
|
||||
}
|
||||
|
||||
// applyFixture — реальный layouter с temp-библиотеками и исходными файлами.
|
||||
type applyFixture struct {
|
||||
w *Worker
|
||||
|
||||
Reference in New Issue
Block a user