tests: Expand HTTP coverage to assert libevent behavior #32408

pull pinheadmz wants to merge 3 commits into bitcoin:master from pinheadmz:http-tests changing 3 files +130 −0
  1. pinheadmz commented at 6:56 pm on May 2, 2025: member

    These commits are cherry-picked from #32061 and part of a project to remove libevent.

    This PR only adds functional tests to interface_http to cover some HTTP server behaviors we inherit from libevent, in order to maintain those behaviors when we replace libevent with our own HTTP server.

    1. Pipelining: The server must respond to requests from a client in the order in which they were received RFC 7230 6.3.2
    2. -rpcservertimeout config option which sets the amount of time the server will keep an idle client connection alive
    3. “Chunked” Transfer-Encoding: Allows a client to send a request in pieces, without the Content-Length header RFC 7230 4.1
  2. test: cover http pipelining e5f054be46
  3. test: cover -rpcservertimeout
    Testing this requires adding an option to TestNode to force
    the test framework to establish a new HTTP connection for
    every RPC. Otherwise, attempting to reuse a persistent connection
    would cause framework RPCs during startup and shutdown to fail.
    1d3f51a3ce
  4. test: cover "chunked" Transfer-Encoding 39c04c7570
  5. DrahtBot commented at 6:56 pm on May 2, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32408.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    Requests are responded to in order they were received → in the order they were received

  6. DrahtBot added the label Tests on May 2, 2025
  7. DrahtBot added the label CI failed on May 2, 2025
  8. in test/functional/interface_http.py:210 in 39c04c7570
    205+        # Wait for response, but expect a timeout disconnection after 1 second
    206+        start = time.time()
    207+        res = sock.recv(1024)
    208+        stop = time.time()
    209+        assert res == b""
    210+        assert stop - start >= 1
    


    maflcko commented at 12:32 pm on May 4, 2025:

    https://cirrus-ci.com/task/5276299050090496?logs=ci#L3261:

    0[15:13:21.244]  node2 2025-05-02T19:13:19.879966Z [httpworker.4] [rpc/request.cpp:241] [parse] [rpc] ThreadRPCServer method=getmempoolinfo user=__cookie__ 
    1[15:13:21.244]  test  2025-05-02T19:13:19.882000Z TestFramework.node2 (DEBUG): RPC successfully started 
    2[15:13:21.244]  test  2025-05-02T19:13:20.885000Z TestFramework (ERROR): Assertion failed 
    3[15:13:21.244]                                    Traceback (most recent call last):
    4[15:13:21.244]                                      File "/ci_container_base/test/functional/test_framework/test_framework.py", line 183, in main
    5[15:13:21.244]                                        self.run_test()
    6[15:13:21.244]                                      File "/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/test/functional/interface_http.py", line 210, in run_test
    7[15:13:21.244]                                        assert stop - start >= 1
    8[15:13:21.244]                                               ^^^^^^^^^^^^^^^^^
    9[15:13:21.244]                                    AssertionError
    

    pinheadmz commented at 1:00 pm on May 4, 2025:
    yeah i see it – gotta figure out why sock.recv(1024) is non blocking on the two failing platforms

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-05-05 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me