Skip to content

Commit 2eb308a

Browse files
committed
SERVER-36299 Ensure that dbclient_cursor_test clears last sent message in between requests
1 parent 15d627c commit 2eb308a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mongo/client/dbclient_cursor_test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ TEST_F(DBClientCursorTest, DBClientCursorHandlesOpMsgExhaustCorrectly) {
177177

178178
// Request more results. This call should trigger the first 'getMore' request with exhaust
179179
// flag set.
180+
conn.clearLastSentMessage();
180181
ASSERT(cursor.more());
181182
m = conn.getLastSentMessage();
182183

@@ -240,6 +241,7 @@ TEST_F(DBClientCursorTest, DBClientCursorResendsGetMoreIfMoreToComeFlagIsOmitted
240241

241242
// Request more results. This call should trigger the first 'getMore' request with exhaust
242243
// flag set.
244+
conn.clearLastSentMessage();
243245
ASSERT(cursor.more());
244246
m = conn.getLastSentMessage();
245247
ASSERT(!m.empty());
@@ -262,6 +264,7 @@ TEST_F(DBClientCursorTest, DBClientCursorResendsGetMoreIfMoreToComeFlagIsOmitted
262264
// Request more results again. This call should trigger another 'getMore' request, since the
263265
// previous response had no 'moreToCome' flag set. This time the mock server will respond with
264266
// the 'moreToCome' flag set.
267+
conn.clearLastSentMessage();
265268
ASSERT(cursor.more());
266269
m = conn.getLastSentMessage();
267270
ASSERT(!m.empty());
@@ -280,6 +283,7 @@ TEST_F(DBClientCursorTest, DBClientCursorResendsGetMoreIfMoreToComeFlagIsOmitted
280283
conn.setRecvResponse(terminalGetMoreResponseMsg);
281284

282285
// Get the last returned document.
286+
conn.clearLastSentMessage();
283287
ASSERT(cursor.more());
284288
ASSERT_BSONOBJ_EQ(terminalDoc, cursor.next());
285289

0 commit comments

Comments
 (0)