summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/querytests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests/querytests.cpp')
-rw-r--r--src/mongo/dbtests/querytests.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 55b5ca9fe34..92611686589 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -34,6 +34,8 @@
namespace mongo {
extern int __findingStartInitialTimeout;
+ void assembleRequest( const string &ns, BSONObj query, int nToReturn, int nToSkip,
+ const BSONObj *fieldsToReturn, int queryOptions, Message &toSend );
}
namespace QueryTests {
@@ -1224,6 +1226,29 @@ namespace QueryTests {
}
};
+ class Exhaust : public CollectionBase {
+ public:
+ Exhaust() : CollectionBase( "exhaust" ) {}
+ void run() {
+ BSONObj info;
+ ASSERT( client().runCommand( "unittests",
+ BSON( "create" << "querytests.exhaust" <<
+ "capped" << true << "size" << 8192 ), info ) );
+ client().insert( ns(), BSON( "ts" << 0 ) );
+ Message message;
+ assembleRequest( ns(), BSON( "ts" << GTE << 0 ), 0, 0, 0,
+ QueryOption_OplogReplay | QueryOption_CursorTailable |
+ QueryOption_Exhaust,
+ message );
+ DbMessage dbMessage( message );
+ QueryMessage queryMessage( dbMessage );
+ Message result;
+ const char *exhaust = runQuery( message, queryMessage, *cc().curop(), result );
+ ASSERT( exhaust );
+ ASSERT_EQUALS( string( ns() ), exhaust );
+ }
+ };
+
namespace parsedtests {
class basic1 {
public:
@@ -1495,6 +1520,7 @@ namespace QueryTests {
add< FindingStartPartiallyFull >();
add< FindingStartStale >();
add< WhatsMyUri >();
+ add< Exhaust >();
add< parsedtests::basic1 >();