alunduil / alunduil/zfs-replicate

Tests pin the ordering and dispatch in task.execute

Aperta
#671 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
24
Fork
6
Merge medio
3h 11m
PR unite (30g)
49

Descrizione

## User story

As a **maintainer of zfs-replicate's test suite**, I want **tests that fail when `task.execute` sorts the wrong way or dispatches an action to the wrong handler**, so that **the order replication actually runs in is pinned by an assertion rather than by inspection**.

## Why

`zfs/replicate/task/execute.py` is the weakest module in the #485 mutation baseline on both measures: 42 survivors, plus 33 mutants no test reaches at all, against 70% line coverage.

The deepest-first sort is entirely unconstrained. Reversing it, dropping the key, and dropping `reverse` all pass:

```
- sorted_tasks = sorted(tasks, key=lambda x: len(x[0].name.split("/")), reverse=True)
+ sorted_tasks = sorted(tasks, key=lambda x: len(x[0].name.split("/")))
```

That matters because the sort is what puts a child filesystem's destroy before its parent's. The 33 unreached mutants sit in the error and follow-delete paths that no test enters.

## Acceptance criteria

- [ ] A test asserts the order `execute` dispatches tasks in for a filesystem set at mixed depths, and fails if the sort reverses or loses its key.
- [ ] A test enters each dispatch branch, so no handler call site is unreached.
- [ ] `poetry run mutmut run --max-children 1 'zfs.replicate.task.execute.*'` reports no survivor and no unreached mutant that a test could have covered. Anything left is noted as an equivalent mutant.

## Out of scope

- Changing what `execute` does. #653 owns the grouping fix.
- The other modules in the #485 baseline; each has its own issue.

## Notes

- Blocked by #653: that fix replaces the dict comprehension this module's mutants sit around, so triaging them first would be redone.
- Reproduce with `poetry install --with mutation` then `poetry run mutmut run --max-children 1`, and read one survivor with `poetry run mutmut show `. Serial matters: the parallel runner mis-attributes verdicts on this suite.
- Follow-up to #485.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.