Skip to content

test(generators): scale the option generator's per-case deadline by PCAPKIT_TEST_TIMEOUT_SCALE (#1428) - #1439

Merged
JarryShaw merged 1 commit into
mainfrom
test/1428-generator-deadline-scale
Oct 8, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1428-generator-deadline-scale

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • test — tests only

Closes #1428

  • DEADLINE goes from 5 s to 30 s, the per-case budget test_option_roundtrip_unit already gives the same cycle. A working case takes ~1–5 ms. A real hang still trips it.
  • New scale_deadline() stretches it by PCAPKIT_TEST_TIMEOUT_SCALE, with the same contract as tests._support.scale_timeout. It reads the variable directly, because the generator is a standalone script. Blank means unscaled. 0, negative, nan, inf, non-numeric, or past 86400 s raise ValueError before any handler is installed. deadline=0 stays off.
  • 'TIMEOUT' and the did not finish within Ns detail are unchanged. N is now the seconds actually allowed.
  • New tests/protocols/test_option_generator_deadline_scale_1428_unit.py: 7 tests. Against main's options.py: 15 failed, 5 passed. With this change: 7 passed, 13 subtests.
  • make_samples.py before and after: all 23 captures have the same md5.
  • Run one module per process, all green: httpv2_stream, 1337, tcp_base, option_roundtrip, option_coverage_runtime, construction_keyword_check, generators_import_their_own_tree, test_support_helpers, and tests/project (404 passed). Ordering leg protocols --exclude protocols/internet: 1091 tests, OK.
  • CI does not set PCAPKIT_TEST_TIMEOUT_SCALE anywhere in .github/workflows/. This PR does not edit workflows.

…CAPKIT_TEST_TIMEOUT_SCALE (#1428)

The 5-second signal.alarm budget in examples/generators/options.py was
flat wall-clock time, so a stalled CI runner failed a ~1.3 ms HTTP/2 case
as 'TIMEOUT'. The default is now 30 s, the budget
test_option_roundtrip_unit already gives the same cycle, and
scale_deadline() stretches it by PCAPKIT_TEST_TIMEOUT_SCALE with the
contract of tests._support.scale_timeout: blank means unscaled, a
non-positive or non-numeric value or one past a day is refused with
ValueError before any handler is installed, and deadline=0 stays off.
The 'TIMEOUT' outcome and its "did not finish within Ns" detail are
kept, naming the seconds actually allowed.
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 8, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at cc234a329 (Sonnet cross-review; the author ran on Opus).

  • scale_deadline() matches tests/_support.py scale_timeout across 60 probes: blank, whitespace, junk, 0, negative, nan/±inf, 1e400, the 86400 ceiling, ceil, and the min of 1. No divergence.
  • deadline=0 arms nothing. A bad scale raises before any handler or alarm is armed, so nothing is left behind.
  • I re-ran it myself. On the PR, the new module gives 7 passed with 13 subtests. With options.py taken from main, it gives 15 failed, 5 passed.
  • All 23 examples/captures/ md5s match main. The neighbour generator modules and tests/project are green (419 passed; the 404 in the body predates later merges).
  • Unverified locally: Python 3.10, since no interpreter is installed. CI covers it.

Nits, no change needed:

  • The parity with scale_timeout is by copy, so a parity assertion could guard against drift.
  • A stray bad PCAPKIT_TEST_TIMEOUT_SCALE now ends make_samples.py with a raw ValueError.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Coverage: 89.48% (unit tier, Python 3.14, cc234a329, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18791 968 2352 869 90.90%
pcapkit/corekit 2043 89 636 25 94.77%
pcapkit/dumpkit 234 2 84 2 98.74%
pcapkit/foundation 2648 98 930 48 94.80%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 16672 218 4490 182 98.07%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2342 1006 157 43.25%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit d13d3b7 into main Oct 8, 2026
41 checks passed
@JarryShaw
JarryShaw deleted the test/1428-generator-deadline-scale branch October 8, 2026 23:03
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 8, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 8, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test(generators): the 5-second per-case DEADLINE in options.py fails CI on a stalled runner

1 participant