anthonyoteri / anthonyoteri/cargo-rigtest
Run teardown / a capture hook even when a test times out
- Linguagem predominante
- Rust
- Estrelas
- 0
- Forks
- 0
- Merge médio
- 3d 18h
- PRs com merge (30d)
- 8
Descrição
## Problem
When a `timeout` fires, the test subprocess is hard-killed and per-test **teardown does not run** (as documented). For a suite driving a shared external backend, a timed-out test can leave that backend in a bad state, cascading failures into every subsequent test. There's also no hook to capture context (logs/state) at the moment of failure or timeout.
## Proposal
1. On timeout, send a cancellation/grace signal and run the registered `ctx.teardown(...)` within a **bounded grace window** before the hard-kill.
2. An optional per-test **on-failure / on-timeout hook** (a closure) that runs to capture diagnostics and attach them to that case's report.
```rust
#[testcase(timeout = Duration::from_secs(30), teardown_grace = Duration::from_secs(5))]
async fn t(ctx: Arc) -> Result<(), rigtest::Error> { /* ... */ Ok(()) }
```
## Why
Guarantees cleanup so one slow/wedged test can't poison siblings that share a backend, and gives a capture point that actually runs when a test dies. Complements #42 (failure capsule) — that packages artifacts; this ensures teardown + a capture point run on timeout. Bounded grace so a wedged teardown can't itself hang.
Guia de contribuição
Direção de pesquisa
The issue names the test subprocess timeout path, the registered ctx.teardown hook, and the proposed per-test capture hook. Start by tracing where timeout handling hard-kills the subprocess and how teardown is registered; done means bounded cleanup and diagnostic capture are specified and verified without allowing a wedged teardown to hang.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust
- Domínio
- testing-qa
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Pouca atividade
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100