msabramo / requests-unixsocket

Use requests to talk HTTP via a UNIX domain socket
Apache License 2.0
207 stars 29 forks source link

testutils: fix test flake on HEAD request #71

Open dbungert opened 9 months ago

dbungert commented 9 months ago

testutils: fix test flake on HEAD request

Flakiness may be observed when running the unit tests. The symptom of that looks like: requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('Hello world!HTTP/1.1 200 OK\r\n'))

We believe that, with the correct send and recv timing, the "Hello world!" body from a HEAD request will be left unread in the reused socket, resulting in an invalid read for the next request along.

Co-authored-by: Olivier Gayot olivier.gayot@canonical.com

dbungert commented 9 months ago

Testing was performed with 39b9c64847a52ddc8c6d14ff414a6a7a3f6358d9 cherry-picked to the branch but is otherwise independent of that change.