summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/directclienttests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests/directclienttests.cpp')
-rw-r--r--src/mongo/dbtests/directclienttests.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp
index 0bea6ea2399..9c96dc331fd 100644
--- a/src/mongo/dbtests/directclienttests.cpp
+++ b/src/mongo/dbtests/directclienttests.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/lasterror.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/util/timer.h"
@@ -52,7 +53,8 @@ namespace DirectClientTests {
class Capped : public ClientBase {
public:
virtual void run() {
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
for( int pass=0; pass < 3; pass++ ) {
client.createCollection(ns, 1024 * 1024, true, 999);
for( int j =0; j < pass*3; j++ )
@@ -76,7 +78,9 @@ namespace DirectClientTests {
class InsertMany : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
vector<BSONObj> objs;
objs.push_back(BSON("_id" << 1));
objs.push_back(BSON("_id" << 1));
@@ -99,7 +103,9 @@ namespace DirectClientTests {
class BadNSCmd : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
BSONObj result;
BSONObj cmdObj = BSON( "count" << "" );
ASSERT_THROWS( client.runCommand( "", cmdObj, result ), UserException );
@@ -109,7 +115,9 @@ namespace DirectClientTests {
class BadNSQuery : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
auto_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 );
ASSERT(cursor->more());
BSONObj result = cursor->next().getOwned();
@@ -121,7 +129,9 @@ namespace DirectClientTests {
class BadNSGetMore : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
auto_ptr<DBClientCursor> cursor = client.getMore("", 1, 1);
ASSERT(cursor->more());
BSONObj result = cursor->next().getOwned();
@@ -133,7 +143,9 @@ namespace DirectClientTests {
class BadNSInsert : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
client.insert( "", BSONObj(), 0 );
ASSERT( !client.getLastError().empty() );
}
@@ -142,7 +154,9 @@ namespace DirectClientTests {
class BadNSUpdate : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
client.update( "", Query(), BSON( "$set" << BSON( "x" << 1 )) );
ASSERT( !client.getLastError().empty() );
}
@@ -151,7 +165,9 @@ namespace DirectClientTests {
class BadNSRemove : ClientBase {
public:
virtual void run(){
- DBDirectClient client;
+ OperationContextImpl txn;
+ DBDirectClient client(&txn);
+
client.remove( "", Query() );
ASSERT( !client.getLastError().empty() );
}