From 8765acc0fcc6ca3dd7158521ba8d864af4e0f2df Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Tue, 4 Apr 2017 15:59:49 -0400 Subject: SERVER-27691 Make OperationContext::setKillAllOperations interrupt all operations --- src/mongo/dbtests/counttests.cpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'src/mongo/dbtests/counttests.cpp') 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") {} -- cgit v1.2.1