anthonyoteri / anthonyoteri/cargo-rigtest
Run teardown / a capture hook even when a test times out
- 主要語言
- Rust
- 星號
- 0
- 分支
- 0
- 平均合併
- 3 天 18 小時
- 30 天內合併 PR
- 8
描述
## 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.
貢獻指南
研究方向
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.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- testing-qa
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100