Commit 9e9cae5
test(live): port func-tests/ from pytest to a cargo integration test (#1606)
The Python `func-tests/test_live_smoke.py` was the last
non-vendored Python in the repo — a pytest harness driving the
real `mergify` binary against the canary repo's Mergify API
endpoints. Now that every command is native, the test runner
itself is the only thing keeping `setup-python` in CI.
Port the 10 tests + the conftest fixtures to a cargo integration
test at `crates/mergify-cli/tests/live_smoke.rs`. 1:1 with the
Python version on contract — same scrubbed env list, same
assertion messages, same skip-on-missing-token behaviour. The
JUnit fixture moves to `crates/mergify-cli/tests/fixtures/` so
cargo packages it consistently.
Notable bits:
- `env!("CARGO_BIN_EXE_mergify")` for the binary path — cargo
sets it at compile time so the test can't accidentally pick
up an installed binary on `$PATH`.
- Token-gated tests early-return after `eprintln!("SKIP: ...")`.
Cargo's stock harness has no "skip" outcome; surfacing the
skip in stderr (visible under `cargo test -- --nocapture`)
means a missing-secret regression in CI can't slip past as a
silent green.
- Cleanup runs from `Drop` (queue unpause; freeze delete) so a
mid-test assertion failure still leaves the canary repo in
the state we found it. Warn (don't panic) inside `drop` so a
cleanup-time issue can't mask the real test failure.
- `wait_timeout` polls `Child::try_wait` to mirror Python
`subprocess.run(timeout=30)`; pulls in no new crate. Kills
and panics on timeout so a hung binary fails fast instead of
riding cargo's longer wall-clock.
CI workflow trimmed: drops `setup-python`, drops the `pip install
pytest` step, drops `PATH` plumbing for the built binary. Test
runner is `cargo test --release --test live_smoke -- --nocapture`.
The release build path is the one whose binary the contract is
pinned against — debug builds would skip the `strip` step that
`build-wheels.yml` enables in production.
Local verification (Linux/macOS, no tokens set): the 3 hermetic
tests pass, the 8 token-gated tests each log
`SKIP: live_(admin_)token() (env var unset)` and early-return.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 9552f3c commit 9e9cae5
6 files changed
Lines changed: 829 additions & 794 deletions
File tree
- .github/workflows
- crates/mergify-cli/tests
- fixtures
- func-tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 27 | | |
37 | | - | |
38 | 28 | | |
39 | 29 | | |
40 | 30 | | |
41 | 31 | | |
42 | 32 | | |
43 | 33 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
49 | 42 | | |
50 | 43 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
File renamed without changes.
0 commit comments