Commit 1308f879 authored by Brandon Schlinker's avatar Brandon Schlinker Committed by Facebook Github Bot

Fix ErrMessageCallback test flakyness

Summary: Need to use `readAll` to ensure that we've read in all bytes that were written (up to EOF). Current approach sometimes returns after only a partial read.

Reviewed By: yfeldblum

Differential Revision: D15456484

fbshipit-source-id: f36a596a3557d4d3714bfaa3c33c726d81ccb5a4
parent 5ca2f8ad
......@@ -3237,10 +3237,10 @@ TEST_P(AsyncSocketErrMessageCallbackTest, ErrMessageCallback) {
ASSERT_EQ(wcb.state, STATE_SUCCEEDED);
// Check that we can read the data that was written to the socket
std::vector<uint8_t> rbuf(1 + wbuf.size(), 0);
uint32_t bytesRead = acceptedSocket->read(rbuf.data(), rbuf.size());
ASSERT_TRUE(std::equal(wbuf.begin(), wbuf.end(), rbuf.begin()));
std::vector<uint8_t> rbuf(wbuf.size(), 0);
uint32_t bytesRead = acceptedSocket->readAll(rbuf.data(), rbuf.size());
ASSERT_EQ(bytesRead, wbuf.size());
ASSERT_TRUE(std::equal(wbuf.begin(), wbuf.end(), rbuf.begin()));
// Close both sockets
acceptedSocket->close();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment