Fix AsyncSocketTest.WriteErrorCallbackBytesWritten
authorYedidya Feldblum <yfeldblum@fb.com>
Thu, 14 Dec 2017 02:00:55 +0000 (18:00 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 14 Dec 2017 02:06:55 +0000 (18:06 -0800)
commit82d8337f03e90168bba5b66f9383228863661e70
tree75dda38f183f78975fb7439e040a69a4db50ed3d
parent8fba851f4a8ec48fb3605e7f75f802bbdc2dcb4f
Fix AsyncSocketTest.WriteErrorCallbackBytesWritten

Summary:
[Folly] Fix `AsyncSocketTest.WriteErrorCallbackBytesWritten`.

Thanks to congestion, especially when the tests are run concurrently, the expectations in the test were too restrictive.

If only 20KB are read, it is possible that only 20KB are acknowledged. The expectation was that if 20KB are read and the recv buffer and send buffer are both 8KB and 24KB are written then all 24KB are acknowledged, but congestion control disagrees.

It is possible that any number of bytes are written to the send buffer, from 28KB up to 40KB. And we have to explicitly wait for 28KB to be written even to know that (otherwise we only know that 20KB are written).

Differential Revision: D6550804

fbshipit-source-id: 100d086972c1526b909da0dbb6e609c144d7b17b
folly/io/async/test/AsyncSocketTest.h
folly/io/async/test/AsyncSocketTest2.cpp