Skip to content

test: rerun flaky test_http_2 on transient HTTP/2 connection termination#2057

Merged
vdusek merged 1 commit into
masterfrom
worktree-fix-flaky
Jul 10, 2026
Merged

test: rerun flaky test_http_2 on transient HTTP/2 connection termination#2057
vdusek merged 1 commit into
masterfrom
worktree-fix-flaky

Conversation

@vdusek

@vdusek vdusek commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

test_http_2 sends a real request to https://apify.com/ to verify HTTP/2 negotiation across the three HTTP clients (curl, httpx, impit). Occasionally the server/CDN gracefully terminates the HTTP/2 connection with a GOAWAY frame (error_code:0), which httpx/httpcore surface as RemoteProtocolError: <ConnectionTerminated ...> without retrying. Crawlee's send_request just re-raises the transport error, so the test fails intermittently in CI (seen on macos-latest / 3.11 — run 29007732402).

The flakiness is external — we don't control apify.com's connection lifecycle — and the test's purpose is to exercise real HTTP/2 negotiation, so it can't be mocked and the local test server is plain HTTP/1.1. Following the project's documented flaky-test policy (tests/unit/README.md), the test is marked @pytest.mark.flaky(reruns=3). A fresh rerun reconnects and negotiates HTTP/2 cleanly, while a genuine HTTP/2 regression would still fail every attempt.

@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Jul 10, 2026
@vdusek vdusek self-assigned this Jul 10, 2026
@vdusek vdusek marked this pull request as ready for review July 10, 2026 07:11
@vdusek vdusek requested a review from Pijukatel July 10, 2026 07:11
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (25c7194) to head (fa073ae).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2057      +/-   ##
==========================================
- Coverage   93.42%   93.41%   -0.02%     
==========================================
  Files         179      179              
  Lines       12495    12495              
==========================================
- Hits        11674    11672       -2     
- Misses        821      823       +2     
Flag Coverage Δ
unit 93.41% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek merged commit e272254 into master Jul 10, 2026
37 checks passed
@vdusek vdusek deleted the worktree-fix-flaky branch July 10, 2026 09:38
Mantisus pushed a commit to Mantisus/crawlee-python that referenced this pull request Jul 10, 2026
…ion (apify#2057)

`test_http_2` sends a real request to `https://apify.com/` to verify
HTTP/2 negotiation across the three HTTP clients (`curl`, `httpx`,
`impit`). Occasionally the server/CDN gracefully terminates the HTTP/2
connection with a GOAWAY frame (`error_code:0`), which
`httpx`/`httpcore` surface as `RemoteProtocolError:
<ConnectionTerminated ...>` without retrying. Crawlee's `send_request`
just re-raises the transport error, so the test fails intermittently in
CI (seen on macos-latest / 3.11 — [run
29007732402](https://github.com/apify/crawlee-python/actions/runs/29007732402/job/86083355443)).

The flakiness is external — we don't control apify.com's connection
lifecycle — and the test's purpose is to exercise real HTTP/2
negotiation, so it can't be mocked and the local test server is plain
HTTP/1.1. Following the project's documented flaky-test policy
(`tests/unit/README.md`), the test is marked
`@pytest.mark.flaky(reruns=3)`. A fresh rerun reconnects and negotiates
HTTP/2 cleanly, while a genuine HTTP/2 regression would still fail every
attempt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants