summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2021-12-15 21:26:52 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-15 22:04:48 +0000
commitb884feb946d3a991b37e5ebeb5944eb8c5edf361 (patch)
tree2940f90b98cde4bdc54c9a631521f82d6c7c0c6e /src
parent10fbdd7be2fbe0dad422762a3ccd0eab30f45bc3 (diff)
downloadmongo-b884feb946d3a991b37e5ebeb5944eb8c5edf361.tar.gz
SERVER-61220 Integration test for progress monitor
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/process_health/SConscript1
-rw-r--r--src/mongo/db/process_health/fault_manager_config.h2
-rw-r--r--src/mongo/db/process_health/test_health_observer.cpp9
3 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/process_health/SConscript b/src/mongo/db/process_health/SConscript
index c2f708db212..a225b2d8470 100644
--- a/src/mongo/db/process_health/SConscript
+++ b/src/mongo/db/process_health/SConscript
@@ -21,6 +21,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/executor/network_interface',
'$BUILD_DIR/mongo/executor/network_interface_factory',
diff --git a/src/mongo/db/process_health/fault_manager_config.h b/src/mongo/db/process_health/fault_manager_config.h
index 1ba938a3d84..18b15a78589 100644
--- a/src/mongo/db/process_health/fault_manager_config.h
+++ b/src/mongo/db/process_health/fault_manager_config.h
@@ -109,7 +109,7 @@ public:
}
Seconds getPeriodicLivenessDeadline() const {
- return Seconds(_getLivenessConfig()->_data->getInterval());
+ return Seconds(_getLivenessConfig()->_data->getDeadline());
}
/** @returns true if the periodic checks are disabled for testing purposes. This is
diff --git a/src/mongo/db/process_health/test_health_observer.cpp b/src/mongo/db/process_health/test_health_observer.cpp
index eeafc987012..254a70f217b 100644
--- a/src/mongo/db/process_health/test_health_observer.cpp
+++ b/src/mongo/db/process_health/test_health_observer.cpp
@@ -28,6 +28,7 @@
*/
#include "mongo/db/process_health/test_health_observer.h"
+#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/process_health/health_observer_registration.h"
namespace mongo {
@@ -54,8 +55,12 @@ Future<HealthCheckStatus> TestHealthObserver::periodicCheckImpl(
namespace {
MONGO_INITIALIZER(TestHealthObserver)(InitializerContext*) {
- HealthObserverRegistration::registerObserverFactory(
- [](ServiceContext* svcCtx) { return std::make_unique<TestHealthObserver>(svcCtx); });
+ // Failpoints can only be set when test commands are enabled, and so the test health observer
+ // is only useful in that case.
+ if (getTestCommandsEnabled()) {
+ HealthObserverRegistration::registerObserverFactory(
+ [](ServiceContext* svcCtx) { return std::make_unique<TestHealthObserver>(svcCtx); });
+ }
}
} // namespace
} // namespace process_health