HathorNetwork / HathorNetwork/tx-mining-service
Flaky: TestDevMiningManager polls only 5s for a multi-second PoW
- Dominant language
- Python
- Stars
- 4
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Two tests in `TestDevMiningManager` fail intermittently under coverage — observed roughly 2 failures in 8 local runs:
- `test_submit_job_with_parents`
- `test_submit_job_with_propagate`
Both submit `TX1_DATA` at its natural weight (~32) and then poll for completion with `for _ in range(50): await asyncio.sleep(0.1)` — a 5-second budget. The file's own comment describes that PoW as taking "a few seconds", so the margin is thin to begin with, and `pytest --cov` instrumentation slows the nonce loop enough to push it over. The failure surfaces as the poll loop exiting while the job is still `mining`, so the assertion reads as a wrong status rather than a timeout, which makes it easy to misread as a real regression.
Each test passes reliably in isolation and the suite passes without coverage, so nothing is wrong with the code under test — only with the budget the harness allows it.
Suggested fix: widen the poll budget in those tests (e.g. `range(200)` for 20s), or drop the tx weight the way `TestSolveTx` does for its trivial-weight case. No assertion changes needed.
Noticed while validating HathorNetwork/tx-mining-service#173; it predates that PR and is unrelated to it, so it was deliberately left out of that changeset.
### Acceptance criteria
- The two tests pass consistently with `pytest --cov` over repeated runs.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.