summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop_test.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-04-06 17:07:02 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-04-07 11:28:49 -0400
commit6febdbaf542464bab747e3ab3ba49ad7b38acd8f (patch)
treeca13cd69929179dc3927cac9895bff3e3fc74787 /src/mongo/db/curop_test.cpp
parent7dc9a83e8be3446551297e746dad4f6d74b7dca2 (diff)
downloadmongo-6febdbaf542464bab747e3ab3ba49ad7b38acd8f.tar.gz
SERVER-17817 Make CurOp a decoration of ClientBasic, not a member of Client.
Diffstat (limited to 'src/mongo/db/curop_test.cpp')
-rw-r--r--src/mongo/db/curop_test.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/db/curop_test.cpp b/src/mongo/db/curop_test.cpp
index f8682c79481..85ad5d98973 100644
--- a/src/mongo/db/curop_test.cpp
+++ b/src/mongo/db/curop_test.cpp
@@ -31,7 +31,14 @@
#include <boost/thread/thread.hpp>
#include "mongo/base/init.h"
+#include "mongo/db/auth/authorization_manager.h"
+#include "mongo/db/auth/authorization_manager_global.h"
+#include "mongo/db/auth/authz_manager_external_state_mock.h"
+#include "mongo/db/client.h"
#include "mongo/db/curop.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_noop.h"
+#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
@@ -67,12 +74,16 @@ namespace mongo {
sleepmillis(10);
}
+ setGlobalServiceContext(stdx::make_unique<ServiceContextNoop>());
+ setGlobalAuthorizationManager(
+ new AuthorizationManager(new AuthzManagerExternalStateMock()));
+ Client::initThread("CurOpTestMain");
return Status::OK();
}
// Long operation + short timeout => time should expire.
TEST(TimeHasExpired, PosSimple) {
- CurOp curOp(NULL);
+ CurOp curOp(&cc());
curOp.setMaxTimeMicros(intervalShort);
curOp.ensureStarted();
sleepmicros(intervalLong);
@@ -81,7 +92,7 @@ namespace mongo {
// Short operation + long timeout => time should not expire.
TEST(TimeHasExpired, NegSimple) {
- CurOp curOp(NULL);
+ CurOp curOp(&cc());
curOp.setMaxTimeMicros(intervalLong);
curOp.ensureStarted();
sleepmicros(intervalShort);