summaryrefslogtreecommitdiff
path: root/src/mongo/executor
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-09-28 06:51:00 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-28 11:14:13 +0000
commit56fcb26c03a537e2dba6729249baac09569e4bcd (patch)
tree95d614ba572fe23b7ffe338264b5c1512c94a18a /src/mongo/executor
parent7b11c89595581a25619b7d45edd39ea8e4915810 (diff)
downloadmongo-56fcb26c03a537e2dba6729249baac09569e4bcd.tar.gz
SERVER-59618 integration tests register LockerNoopClientObserver with ServiceContext
Diffstat (limited to 'src/mongo/executor')
-rw-r--r--src/mongo/executor/network_interface_integration_test.cpp3
-rw-r--r--src/mongo/executor/thread_pool_task_executor_integration_test.cpp8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp
index d3944e24cb8..fdf1ac6f8ba 100644
--- a/src/mongo/executor/network_interface_integration_test.cpp
+++ b/src/mongo/executor/network_interface_integration_test.cpp
@@ -37,6 +37,7 @@
#include "mongo/base/status_with.h"
#include "mongo/client/connection_string.h"
+#include "mongo/db/concurrency/locker_noop_client_observer.h"
#include "mongo/executor/connection_pool_stats.h"
#include "mongo/executor/network_connection_hook.h"
#include "mongo/executor/network_interface_integration_fixture.h"
@@ -529,6 +530,7 @@ TEST_F(NetworkInterfaceTest, AsyncOpTimeoutWithOpCtxDeadlineSooner) {
constexpr auto requestTimeout = Milliseconds{1000};
auto serviceContext = ServiceContext::make();
+ serviceContext->registerClientObserver(std::make_unique<LockerNoopClientObserver>());
auto client = serviceContext->makeClient("NetworkClient");
auto opCtx = client->makeOperationContext();
opCtx->setDeadlineAfterNowBy(opCtxDeadline, ErrorCodes::ExceededTimeLimit);
@@ -564,6 +566,7 @@ TEST_F(NetworkInterfaceTest, AsyncOpTimeoutWithOpCtxDeadlineLater) {
constexpr auto requestTimeout = Milliseconds{600};
auto serviceContext = ServiceContext::make();
+ serviceContext->registerClientObserver(std::make_unique<LockerNoopClientObserver>());
auto client = serviceContext->makeClient("NetworkClient");
auto opCtx = client->makeOperationContext();
opCtx->setDeadlineAfterNowBy(opCtxDeadline, ErrorCodes::ExceededTimeLimit);
diff --git a/src/mongo/executor/thread_pool_task_executor_integration_test.cpp b/src/mongo/executor/thread_pool_task_executor_integration_test.cpp
index 113046ff192..da4c078404b 100644
--- a/src/mongo/executor/thread_pool_task_executor_integration_test.cpp
+++ b/src/mongo/executor/thread_pool_task_executor_integration_test.cpp
@@ -32,6 +32,7 @@
#include "mongo/executor/task_executor.h"
+#include "mongo/db/concurrency/locker_noop_client_observer.h"
#include "mongo/db/namespace_string.h"
#include "mongo/executor/network_interface_factory.h"
#include "mongo/executor/network_interface_thread_pool.h"
@@ -46,6 +47,11 @@ namespace {
class TaskExecutorFixture : public mongo::unittest::Test {
public:
+ TaskExecutorFixture() {
+ _serviceCtx = ServiceContext::make();
+ _serviceCtx->registerClientObserver(std::make_unique<LockerNoopClientObserver>());
+ }
+
void setUp() override {
std::shared_ptr<NetworkInterface> net = makeNetworkInterface("TaskExecutorTest");
auto tp = std::make_unique<NetworkInterfaceThreadPool>(net.get());
@@ -73,7 +79,7 @@ public:
return false;
}
- ServiceContext::UniqueServiceContext _serviceCtx = ServiceContext::make();
+ ServiceContext::UniqueServiceContext _serviceCtx;
std::shared_ptr<ThreadPoolTaskExecutor> _executor;
};