summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/counttests.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-04-04 15:59:49 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-04-05 12:44:10 -0400
commit8765acc0fcc6ca3dd7158521ba8d864af4e0f2df (patch)
tree9fc35ffc0f93b334bbc846cb6ccf91250ae11252 /src/mongo/dbtests/counttests.cpp
parent97691221bcf43245ddfd906766abc93bb617d2aa (diff)
downloadmongo-8765acc0fcc6ca3dd7158521ba8d864af4e0f2df.tar.gz
SERVER-27691 Make OperationContext::setKillAllOperations interrupt all operations
Diffstat (limited to 'src/mongo/dbtests/counttests.cpp')
-rw-r--r--src/mongo/dbtests/counttests.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index 72eef6f6097..2ae6da87932 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -1,5 +1,3 @@
-// counttests.cpp : count.{h,cpp} unit tests.
-
/**
* Copyright (C) 2008 10gen Inc.
*
@@ -35,19 +33,12 @@
#include "mongo/db/db.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/dbhelpers.h"
-#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/json.h"
-#include "mongo/stdx/thread.h"
-
#include "mongo/dbtests/dbtests.h"
+#include "mongo/stdx/thread.h"
namespace CountTests {
-namespace {
-const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
-} // namespace
-
class Base {
public:
Base()
@@ -66,8 +57,10 @@ public:
wunit.commit();
}
- addIndex(fromjson("{\"a\":1}"));
+ DBDirectClient client(&_opCtx);
+ client.createIndex(ns(), IndexSpec().addKey("a").unique(false));
}
+
~Base() {
try {
WriteUnitOfWork wunit(&_opCtx);
@@ -83,15 +76,6 @@ protected:
return "unittests.counttests";
}
- void addIndex(const BSONObj& key) {
- Helpers::ensureIndex(&_opCtx,
- _collection,
- key,
- kIndexVersion,
- /*unique=*/false,
- /*name=*/key.firstElementFieldName());
- }
-
void insert(const char* s) {
WriteUnitOfWork wunit(&_opCtx);
const BSONObj o = fromjson(s);
@@ -110,7 +94,6 @@ protected:
wunit.commit();
}
-
const ServiceContext::UniqueOperationContext _opCtxPtr = cc().makeOperationContext();
OperationContext& _opCtx = *_opCtxPtr;
Lock::DBLock _lk;
@@ -162,7 +145,6 @@ public:
}
};
-
class All : public Suite {
public:
All() : Suite("count") {}