summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-04-28 13:15:57 -0400
committerEliot Horowitz <eliot@10gen.com>2011-04-28 13:15:57 -0400
commit77f533612ca7eaa54b9c0718e18462bae541c0f9 (patch)
tree3d79f1e11681dcc2855d231df732b714e24ffd6f /client
parentdd1877599f6e8cd383ab102816f38388e4516069 (diff)
downloadmongo-77f533612ca7eaa54b9c0718e18462bae541c0f9.tar.gz
test for SERVER-3014
Diffstat (limited to 'client')
-rw-r--r--client/examples/clientTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/client/examples/clientTest.cpp b/client/examples/clientTest.cpp
index 96c014e245c..aaea6bd1bdf 100644
--- a/client/examples/clientTest.cpp
+++ b/client/examples/clientTest.cpp
@@ -246,5 +246,34 @@ int main( int argc, const char **argv ) {
//MONGO_PRINT(out);
}
+ {
+ // test timeouts
+
+ DBClientConnection conn( true , 0 , 2 );
+ if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) {
+ cout << "couldn't connect : " << errmsg << endl;
+ throw -11;
+ }
+ conn.insert( "test.totest" , BSON( "x" << 1 ) );
+ BSONObj res;
+
+ bool gotError = false;
+ assert( conn.eval( "test" , "return db.totest.findOne().x" , res ) );
+ try {
+ conn.eval( "test" , "sleep(5000); return db.totest.findOne().x" , res );
+ }
+ catch ( std::exception& e ) {
+ gotError = true;
+ log() << e.what() << endl;
+ }
+ assert( gotError );
+ // sleep so the server isn't locked anymore
+ sleepsecs( 4 );
+
+ assert( conn.eval( "test" , "return db.totest.findOne().x" , res ) );
+
+
+ }
+
cout << "client test finished!" << endl;
}