summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-05-13 00:13:55 -0700
committerAaron <aaron@10gen.com>2010-05-13 00:24:24 -0700
commit598ef8ba63003776aad5cce9d85814f529e1306c (patch)
treede8561ec0de823c19719233536369765766051df
parentfc58c9babfde872a7c876951064a890a4cf61aa0 (diff)
downloadmongo-598ef8ba63003776aad5cce9d85814f529e1306c.tar.gz
SERVER-1113
-rw-r--r--dbtests/querytests.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/dbtests/querytests.cpp b/dbtests/querytests.cpp
index f1755439cb7..24b71c406b7 100644
--- a/dbtests/querytests.cpp
+++ b/dbtests/querytests.cpp
@@ -978,7 +978,9 @@ namespace QueryTests {
for( int j = -1; j < i; ++j ) {
auto_ptr< DBClientCursor > c = client().query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( c->more() );
- ASSERT_EQUALS( ( j > min ? j : min ), c->next()[ "ts" ].numberInt() );
+ BSONObj next = c->next();
+ ASSERT( !next[ "ts" ].eoo() );
+ ASSERT_EQUALS( ( j > min ? j : min ), next[ "ts" ].numberInt() );
}
}
}
@@ -987,6 +989,40 @@ namespace QueryTests {
int _old;
};
+ class FindingStartPartiallyFull : public CollectionBase {
+ public:
+ FindingStartPartiallyFull() : CollectionBase( "findingstart" ), _old( __findingStartInitialTimeout ) {
+ __findingStartInitialTimeout = 0;
+ }
+ ~FindingStartPartiallyFull() {
+ __findingStartInitialTimeout = _old;
+ }
+
+ void run() {
+ BSONObj info;
+ ASSERT( client().runCommand( "unittests", BSON( "create" << "querytests.findingstart" << "capped" << true << "size" << 10000 << "$nExtents" << 5 << "autoIndexId" << false ), info ) );
+
+ int i = 0;
+ for( ; i < 150; client().insert( ns(), BSON( "ts" << i++ ) ) );
+
+ for( int k = 0; k < 5; ++k ) {
+ client().insert( ns(), BSON( "ts" << i++ ) );
+ int min = client().query( ns(), Query().sort( BSON( "$natural" << 1 ) ) )->next()[ "ts" ].numberInt();
+ for( int j = -1; j < i; ++j ) {
+ auto_ptr< DBClientCursor > c = client().query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
+ ASSERT( c->more() );
+ BSONObj next = c->next();
+ ASSERT( !next[ "ts" ].eoo() );
+ ASSERT_EQUALS( ( j > min ? j : min ), next[ "ts" ].numberInt() );
+ }
+ }
+ }
+
+ private:
+ int _old;
+ };
+
+
class WhatsMyUri : public CollectionBase {
public:
WhatsMyUri() : CollectionBase( "whatsmyuri" ) {}
@@ -1069,6 +1105,7 @@ namespace QueryTests {
add< HelperTest >();
add< HelperByIdTest >();
add< FindingStart >();
+ add< FindingStartPartiallyFull >();
add< WhatsMyUri >();
add< parsedtests::basic1 >();