Thirty-five tests skip themselves and are reported as passed #137
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thirty-five tests across seven files skip themselves by printing a note and returning, and nextest counts every one of them as passed:
Measured while reviewing #106: in a worktree without
reference/snapshots/copied in, 15 of the 35 were vacuous — they printed their note, returned, and were reported green.scan_enriched.rs's twelve run in 0.011 s each when vacuous and 2.3 s or more when real, so the difference is visible in the timing and nowhere in the result.The workspace already has an honest idiom for this and uses it for nine other tests: a build-script
cfgplus#[cfg_attr(…, ignore)], which nextest reports as skipped. Two idioms, one of which lies.Why this is worth more than any single issue
Every milestone in this project has an entry about a check that reported success while measuring nothing:
bundle.jsonasked for an account that no longer existed and 10 of 43 responses were answered by neither server, and the run passed. It is held to"max_unanswered": 0now for exactly that reason.visibility.jsonwas built almost entirely out of refusals, so a regression returningNonefor every restricted account would have diffed clean.This is the same failure one layer down, in the test runner rather than the harness — and it is the layer that is supposed to catch the others.
JELLYFIN_RS_REQUIRE_FIXTURES=1exists and is the right lever: CI sets it, and under it a missing fixture fails instead of leaving a note. But it is opt-in, and a developer or an agent runningcargo nextest run --workspacein a fresh worktree gets fifteen green tests that did nothing. That is where the port is actually written.Where to start
The seven files that use the silent form, and
crates/jellyfin-app/tests/scan_enriched.rs:105-115for the shape of the gate. The nine honest ones are the model.Two things to decide rather than assume:
xtaskcan detect for itself.scan_enriched.rs'senriched_libraries()(added by #106) filters on a directory existing with no note at all and no env-var escape, so it is quiet even in CI. A gate with no way to make it loud is worse than one with an opt-in.How to know it is done
A test that cannot run says so in a way nextest reports as skipped rather than passed, and a run with
JELLYFIN_RS_REQUIRE_FIXTURES=1in a worktree missing a fixture fails and names what is missing. Then the count in a green run means what it says — which is the only reason to keep counts in a close comment at all.House rules
Tests run under
cargo nextest; upstream's source is the checkout inupstream/at the pin; generated artifacts are regenerated, never edited; comments say what the code does, not how it got there. Kill processes by PID after checking/proc/<pid>/cwd, never bypkill -f— the pattern matches the shell running it.Landed in
48dbd8aand0c62072.The gate moved to build time.
crates/ephyra-fixturesnames each fixture once —the snapshot, the media, the enriched media, the upstream checkout,
ffmpegandffprobeon PATH — a build script per crate declares the cfg for whichever thecheckout has, and each gated test carries
#[cfg_attr(not(has_…), ignore = "…")].Past the gate the fixture is required rather than probed: the helpers return the
path and assert, so the
let Some(x) = f() else { return }that turned amissing fixture into a green test is gone from all eight files.
The two things this wanted decided rather than written.
Whether the env var should be the default rather than the escape — neither, in
the end. The cfg makes the default honest, so
EPHYRA_REQUIRE_FIXTURESnolonger has to carry that weight; it fails the build instead, naming what is
missing before a test runs. Louder than a per-test assert, and it cannot be
reached vacuously.
What a gate that cannot be satisfied should do —
enriched_libraries()nowasserts all three sub-libraries rather than quietly dropping one, which is what
its own doc comment already said it wanted.
Measured, in a worktree with no
reference/copied in:And
EPHYRA_REQUIRE_FIXTURES=1there fails the build withneeds reference/snapshots/default/config/data/jellyfin.db — run cargo xtask reference bootstrap.One review round, which found two defects in the new crate, both fixed in
0c62072:declare_programswatched nothing, so installing ffmpeg never liftedthe ignore; and 28 tests that spawn
ffprobewere gated only on the media, so amachine with the fixtures but no ffmpeg build failed them rather than ignoring
them.
Two things left, neither in this issue's scope:
cargoinvocation — awatched path that does not exist is dirty forever. It is the price of the
ignore lifting when you provision one, and it was already true of
ephyra-dbandxtask.scan_enriched.rsderives its scratch directory fromprocess::id()alone,so its twelve tests share one path under a single-process runner. Safe under
nextest, not under
cargo test.