diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-28 12:21:39 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-28 12:21:39 -0400 |
commit | 89fcbab94c7103105e8c72f654a5774a066bdb90 (patch) | |
tree | 5dccab74eaf78f104c8bbbbb869eed0374ecd02b /src/mongo/dbtests/clienttests.cpp | |
parent | 52edab726185cbba1401cb46de221fb3d1cb0408 (diff) | |
download | mongo-89fcbab94c7103105e8c72f654a5774a066bdb90.tar.gz |
Revert "SERVER-13961 Add OperationContext argument to Client::Context"
This reverts commit 52edab726185cbba1401cb46de221fb3d1cb0408.
Diffstat (limited to 'src/mongo/dbtests/clienttests.cpp')
-rw-r--r-- | src/mongo/dbtests/clienttests.cpp | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp index 1ba539f0266..527f52f2554 100644 --- a/src/mongo/dbtests/clienttests.cpp +++ b/src/mongo/dbtests/clienttests.cpp @@ -40,23 +40,19 @@ namespace ClientTests { class Base { public: - Base( string coll ) : _ns("test." + coll) { - OperationContextImpl txn; - DBDirectClient db(&txn); - + Base( string coll ) { db.dropDatabase("test"); + _ns = (string)"test." + coll; } virtual ~Base() { - OperationContextImpl txn; - DBDirectClient db(&txn); - db.dropCollection( _ns ); } const char * ns() { return _ns.c_str(); } - const string _ns; + string _ns; + DBDirectClient db; }; @@ -64,9 +60,6 @@ namespace ClientTests { public: DropIndex() : Base( "dropindex" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); - db.insert( ns() , BSON( "x" << 2 ) ); ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() ); @@ -88,8 +81,6 @@ namespace ClientTests { public: ReIndex() : Base( "reindex" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); db.insert( ns() , BSON( "x" << 2 ) ); ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() ); @@ -107,8 +98,6 @@ namespace ClientTests { public: ReIndex2() : Base( "reindex2" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); db.insert( ns() , BSON( "x" << 2 ) ); ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() ); @@ -134,9 +123,7 @@ namespace ClientTests { BuildIndex() : Base("buildIndex") {} void run() { OperationContextImpl txn; - Client::WriteContext ctx(&txn, ns()); - DBDirectClient db(&txn); db.insert(ns(), BSON("x" << 1 << "y" << 2)); db.insert(ns(), BSON("x" << 2 << "y" << 2)); @@ -171,14 +158,9 @@ namespace ClientTests { public: CS_10() : Base( "CS_10" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); - - const string longs( 770, 'c' ); - for (int i = 0; i < 1111; ++i) { - db.insert(ns(), BSON("a" << i << "b" << longs)); - } - + string longs( 770, 'c' ); + for( int i = 0; i < 1111; ++i ) + db.insert( ns(), BSON( "a" << i << "b" << longs ) ); db.ensureIndex( ns(), BSON( "a" << 1 << "b" << 1 ) ); auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) ); @@ -190,13 +172,8 @@ namespace ClientTests { public: PushBack() : Base( "PushBack" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); - - for (int i = 0; i < 10; ++i) { - db.insert(ns(), BSON("i" << i)); - } - + for( int i = 0; i < 10; ++i ) + db.insert( ns(), BSON( "i" << i ) ); auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) ); BSONObj o = c->next(); @@ -235,10 +212,7 @@ namespace ClientTests { public: Create() : Base( "Create" ) {} void run() { - OperationContextImpl txn; - DBDirectClient db(&txn); - - db.createCollection("unittests.clienttests.create", 4096, true); + db.createCollection( "unittests.clienttests.create", 4096, true ); BSONObj info; ASSERT( db.runCommand( "unittests", BSON( "collstats" << "clienttests.create" ), info ) ); } @@ -263,7 +237,6 @@ namespace ClientTests { class All : public Suite { public: All() : Suite( "client" ) { - } void setupTests() { |