Skip to content

Local test server - #407

Merged
trowski merged 5 commits into
amphp:5.xfrom
lav45:local-test-server
Nov 9, 2026
Merged

trowski merged 5 commits into
amphp:5.xfrom
lav45:local-test-server

Conversation

@lav45

@lav45 lav45 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Problem

The test suite depends on third-party hosts: httpbin.org, badssl.com, nghttp2.org, cdn77.org, stackoverflow.com
and amphp.org. A change on any of them fails CI for unrelated pull requests. For example, #405 failed on
testReason and testMultipartBodyRequest because of httpbin.org responses, and fail-fast then cancelled the
remaining jobs.

Solution

LocalHttpBin in test/Support serves the routes the tests need from the test process, over HTTP and HTTPS. It uses
amphp/http-server, as Http2IntegrationTest and InterceptorTest already do, so there are no new dependencies and
no external services. It works on every OS in the CI matrix.

Test changes

  • testGzipBomb, testHttp2TeHeader and testHttp2UpgradeResponse are no longer skipped.
  • testGzipBomb now expects StreamException, which is what the size limit throws, instead of ParseException.
  • testReason uses a raw server response, because amphp/http-server sends no reason for 418.
  • testSingleConnectionDoNotUseBody and testSingleConnectionDoNotUseBodyHttp2 now await both requests, so the
    second one isn't aborted when the server stops.
  • testDhKeyTooSmall can't use a 512-bit key: OpenSSL 3.5 refuses to load it on the server. The server uses a 2048-bit
    key from test/tls/dh2048.pem over TLS 1.2, and the client sets security level 3, which gives the same
    dh key too small error.
  • testDhKeyTooSmall runs on Linux only. On macOS the handshake succeeded and the request hit the transfer timeout,
    so the test didn't reach the expected error. The cause isn't known yet.
  • testHttp2Push stays skipped and still refers to its old external URL. A local run didn't work: the pushed response
    didn't arrive within 100 ms of the parent request.

CI

There is a new PHP 8.6 job on Ubuntu with continue-on-error, so its failures don't block the other jobs. Psalm, the
style fixer and composer-require-checker are off for this job, and Composer runs with --ignore-platform-req=php+.

lav45 and others added 5 commits November 3, 2026 01:40
The tests depended on httpbin.org, badssl.com, nghttp2.org and other third-party hosts, so a change in any of them failed CI. LocalHttpBin serves the same routes from the test process on every OS the CI matrix uses.
On macOS the handshake succeeds despite the client security level, so the request runs into the transfer timeout instead of a TLS error.
@trowski
trowski merged commit 6052007 into amphp:5.x Nov 9, 2026
8 checks passed
@trowski

trowski commented Nov 9, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants