diff options
Diffstat (limited to 'src/mongo/db/query/getmore_request_test.cpp')
-rw-r--r-- | src/mongo/db/query/getmore_request_test.cpp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/src/mongo/db/query/getmore_request_test.cpp b/src/mongo/db/query/getmore_request_test.cpp index 997310c9645..94dfb9ba366 100644 --- a/src/mongo/db/query/getmore_request_test.cpp +++ b/src/mongo/db/query/getmore_request_test.cpp @@ -30,9 +30,9 @@ #include <string> -#include "mongo/db/repl/optime.h" -#include "mongo/db/query/getmore_request.h" #include "mongo/db/jsobj.h" +#include "mongo/db/query/getmore_request.h" +#include "mongo/db/repl/optime.h" #include "mongo/unittest/unittest.h" @@ -60,7 +60,8 @@ TEST(GetMoreRequestTest, parseFromBSONCursorIdNotLongLong) { StatusWith<GetMoreRequest> result = GetMoreRequest::parseFromBSON("db", BSON("getMore" << "not a number" - << "collection" << 123)); + << "collection" + << 123)); ASSERT_NOT_OK(result.getStatus()); ASSERT_EQUALS(ErrorCodes::TypeMismatch, result.getStatus().code()); } @@ -115,7 +116,8 @@ TEST(GetMoreRequestTest, parseFromBSONUnrecognizedFieldName) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "unknown_field" << 1)); + << "unknown_field" + << 1)); ASSERT_NOT_OK(result.getStatus()); ASSERT_EQUALS(ErrorCodes::FailedToParse, result.getStatus().code()); } @@ -125,7 +127,8 @@ TEST(GetMoreRequestTest, parseFromBSONInvalidBatchSize) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "batchSize" << -1)); + << "batchSize" + << -1)); ASSERT_NOT_OK(result.getStatus()); ASSERT_EQUALS(ErrorCodes::BadValue, result.getStatus().code()); } @@ -135,7 +138,8 @@ TEST(GetMoreRequestTest, parseFromBSONInvalidBatchSizeOfZero) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "batchSize" << 0)); + << "batchSize" + << 0)); ASSERT_NOT_OK(result.getStatus()); ASSERT_EQUALS(ErrorCodes::BadValue, result.getStatus().code()); } @@ -156,7 +160,8 @@ TEST(GetMoreRequestTest, parseFromBSONBatchSizeProvided) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "batchSize" << 200)); + << "batchSize" + << 200)); ASSERT_EQUALS("db.coll", result.getValue().nss.toString()); ASSERT_EQUALS(CursorId(123), result.getValue().cursorid); ASSERT(result.getValue().batchSize); @@ -180,7 +185,8 @@ TEST(GetMoreRequestTest, parseFromBSONHasMaxTimeMS) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "maxTimeMS" << 100)); + << "maxTimeMS" + << 100)); ASSERT_OK(result.getStatus()); ASSERT_EQUALS("db.coll", result.getValue().nss.toString()); ASSERT(result.getValue().awaitDataTimeout); @@ -193,7 +199,8 @@ TEST(GetMoreRequestTest, parseFromBSONHasMaxTimeMSOfZero) { GetMoreRequest::parseFromBSON("db", BSON("getMore" << CursorId(123) << "collection" << "coll" - << "maxTimeMS" << 0)); + << "maxTimeMS" + << 0)); ASSERT_OK(result.getStatus()); ASSERT_EQUALS("db.coll", result.getValue().nss.toString()); ASSERT_EQUALS(CursorId(123), result.getValue().cursorid); @@ -208,7 +215,8 @@ TEST(GetMoreRequestTest, toBSONHasBatchSize) { BSONObj requestObj = request.toBSON(); BSONObj expectedRequest = BSON("getMore" << CursorId(123) << "collection" << "testcoll" - << "batchSize" << 99); + << "batchSize" + << 99); ASSERT_EQ(requestObj, expectedRequest); } @@ -231,7 +239,10 @@ TEST(GetMoreRequestTest, toBSONHasTerm) { BSONObj requestObj = request.toBSON(); BSONObj expectedRequest = BSON("getMore" << CursorId(123) << "collection" << "testcoll" - << "batchSize" << 99 << "term" << 1); + << "batchSize" + << 99 + << "term" + << 1); ASSERT_EQ(requestObj, expectedRequest); } @@ -243,11 +254,14 @@ TEST(GetMoreRequestTest, toBSONHasCommitLevel) { 1, repl::OpTime(Timestamp(0, 10), 2)); BSONObj requestObj = request.toBSON(); - BSONObj expectedRequest = - BSON("getMore" << CursorId(123) << "collection" - << "testcoll" - << "batchSize" << 99 << "term" << 1 << "lastKnownCommittedOpTime" - << BSON("ts" << Timestamp(0, 10) << "t" << 2LL)); + BSONObj expectedRequest = BSON("getMore" << CursorId(123) << "collection" + << "testcoll" + << "batchSize" + << 99 + << "term" + << 1 + << "lastKnownCommittedOpTime" + << BSON("ts" << Timestamp(0, 10) << "t" << 2LL)); ASSERT_EQ(requestObj, expectedRequest); } @@ -261,7 +275,8 @@ TEST(GetMoreRequestTest, toBSONHasMaxTimeMS) { BSONObj requestObj = request.toBSON(); BSONObj expectedRequest = BSON("getMore" << CursorId(123) << "collection" << "testcoll" - << "maxTimeMS" << 789); + << "maxTimeMS" + << 789); ASSERT_EQ(requestObj, expectedRequest); } |