summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmirsaman Memaripour <amirsaman.memaripour@mongodb.com>2020-06-08 16:21:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-10 03:27:58 +0000
commit674a5f6015ca455f47af4a3b0ebed4b8a9281b8d (patch)
tree701caf90077a3c040940e78ad92678b1429b90db /src
parentac9c07e1014ec0ab28ec90522c8d5043c4bacbc8 (diff)
downloadmongo-674a5f6015ca455f47af4a3b0ebed4b8a9281b8d.tar.gz
SERVER-46726 Using testing proctor to control diagnostics
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/free_mon/free_mon_mongod.cpp7
-rw-r--r--src/mongo/db/s/shard_filtering_metadata_refresh.cpp1
-rw-r--r--src/mongo/db/s/txn_two_phase_commit_cmds.cpp1
-rw-r--r--src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp1
-rw-r--r--src/mongo/db/service_entry_point_common.cpp1
-rw-r--r--src/mongo/executor/SConscript1
-rw-r--r--src/mongo/executor/network_interface.h2
-rw-r--r--src/mongo/executor/network_interface_integration_test.cpp1
-rw-r--r--src/mongo/rpc/SConscript1
-rw-r--r--src/mongo/rpc/metadata.cpp4
-rw-r--r--src/mongo/s/SConscript1
-rw-r--r--src/mongo/s/commands/cluster_command_test_fixture.cpp1
-rw-r--r--src/mongo/s/commands/cluster_multicast_cmd.cpp1
-rw-r--r--src/mongo/s/commands/strategy.cpp1
-rw-r--r--src/mongo/util/latch_analyzer_test.cpp1
15 files changed, 7 insertions, 18 deletions
diff --git a/src/mongo/db/free_mon/free_mon_mongod.cpp b/src/mongo/db/free_mon/free_mon_mongod.cpp
index f755e2f58da..bc33c921855 100644
--- a/src/mongo/db/free_mon/free_mon_mongod.cpp
+++ b/src/mongo/db/free_mon/free_mon_mongod.cpp
@@ -45,7 +45,6 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/bsontypes.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/free_mon/free_mon_controller.h"
#include "mongo/db/free_mon/free_mon_message.h"
@@ -66,6 +65,7 @@
#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/future.h"
#include "mongo/util/net/http_client.h"
+#include "mongo/util/testing_proctor.h"
namespace mongo {
@@ -90,7 +90,7 @@ public:
_executor = makeTaskExecutor(serviceContext);
_executor->startup();
_client = HttpClient::create();
- _client->allowInsecureHTTP(getTestCommandsEnabled());
+ _client->allowInsecureHTTP(TestingProctor::instance().isEnabled());
_client->setHeaders({"Content-Type: application/octet-stream",
"Accept: application/octet-stream",
"Expect:"});
@@ -312,8 +312,7 @@ void startFreeMonitoring(ServiceContext* serviceContext) {
return;
}
- // Check for http, not https here because testEnabled may not be set yet
- if (!getTestCommandsEnabled()) {
+ if (!TestingProctor::instance().isEnabled()) {
uassert(50774,
"ExportedFreeMonEndpointURL only supports https:// URLs",
FreeMonEndpointURL.compare(0, 5, "https") == 0);
diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
index 270d2af9bd6..a8a79247214 100644
--- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
+++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
@@ -36,7 +36,6 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/catalog_raii.h"
#include "mongo/db/commands/feature_compatibility_version.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/s/collection_sharding_runtime.h"
#include "mongo/db/s/database_sharding_state.h"
diff --git a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
index 9cc24d5a948..81da126ff96 100644
--- a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
+++ b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
+#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/commands/txn_two_phase_commit_cmds_gen.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/s/sharding_state.h"
diff --git a/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp b/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp
index 04a0e6dce92..ff470884b98 100644
--- a/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp
+++ b/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp
@@ -32,7 +32,6 @@
#include "mongo/platform/basic.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/s/chunk_splitter.h"
namespace mongo {
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index fa1e80051ac..7f558fe2a3f 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -43,7 +43,6 @@
#include "mongo/db/client.h"
#include "mongo/db/command_can_run_here.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/commands/txn_cmds_gen.h"
#include "mongo/db/curop.h"
#include "mongo/db/curop_failpoint_helpers.h"
diff --git a/src/mongo/executor/SConscript b/src/mongo/executor/SConscript
index 07b4247e951..80ee3174a12 100644
--- a/src/mongo/executor/SConscript
+++ b/src/mongo/executor/SConscript
@@ -275,7 +275,6 @@ env.CppIntegrationTest(
],
LIBDEPS=[
'$BUILD_DIR/mongo/client/clientdriver_network',
- '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/db/wire_version',
'$BUILD_DIR/mongo/executor/network_interface_factory',
'$BUILD_DIR/mongo/executor/network_interface_thread_pool',
diff --git a/src/mongo/executor/network_interface.h b/src/mongo/executor/network_interface.h
index 5d59265e250..3a30c0e0893 100644
--- a/src/mongo/executor/network_interface.h
+++ b/src/mongo/executor/network_interface.h
@@ -137,7 +137,7 @@ public:
};
/*
* Returns a copy of the operation counters (see struct Counters above). This method should
- * only be used in tests, and will invariant if getTestCommands() returns false.
+ * only be used in tests, and will invariant if testing diagnostics are not enabled.
*/
virtual Counters getCounters() const = 0;
diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp
index 36d0b6aae60..28883008399 100644
--- a/src/mongo/executor/network_interface_integration_test.cpp
+++ b/src/mongo/executor/network_interface_integration_test.cpp
@@ -37,7 +37,6 @@
#include "mongo/base/status_with.h"
#include "mongo/client/connection_string.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/wire_version.h"
#include "mongo/executor/connection_pool_stats.h"
#include "mongo/executor/network_connection_hook.h"
diff --git a/src/mongo/rpc/SConscript b/src/mongo/rpc/SConscript
index 1dd66473f21..88d1f637bf6 100644
--- a/src/mongo/rpc/SConscript
+++ b/src/mongo/rpc/SConscript
@@ -107,7 +107,6 @@ env.Library(
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/bson/util/bson_extract',
'$BUILD_DIR/mongo/client/read_preference',
- '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/db/repl/optime',
'$BUILD_DIR/mongo/db/signed_logical_time',
],
diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp
index 2220e31755e..493d7ddac44 100644
--- a/src/mongo/rpc/metadata.cpp
+++ b/src/mongo/rpc/metadata.cpp
@@ -33,7 +33,6 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/dbmessage.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/logical_clock.h"
@@ -45,6 +44,7 @@
#include "mongo/rpc/metadata/sharding_metadata.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/util/string_map.h"
+#include "mongo/util/testing_proctor.h"
namespace mongo {
namespace rpc {
@@ -83,7 +83,7 @@ void readRequestMetadata(OperationContext* opCtx,
AuthorizationSession* authSession = AuthorizationSession::get(opCtx->getClient());
if (clientOperationKeyElem &&
- (getTestCommandsEnabled() ||
+ (TestingProctor::instance().isEnabled() ||
authSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
ActionType::internal))) {
auto opKey = uassertStatusOK(UUID::parse(clientOperationKeyElem));
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index e5b3ec08eb6..91e08c4277c 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -263,7 +263,6 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/executor/thread_pool_task_executor',
'$BUILD_DIR/mongo/s/client/sharding_client',
'cluster_last_error_info',
diff --git a/src/mongo/s/commands/cluster_command_test_fixture.cpp b/src/mongo/s/commands/cluster_command_test_fixture.cpp
index 81951cd425c..2b76854de31 100644
--- a/src/mongo/s/commands/cluster_command_test_fixture.cpp
+++ b/src/mongo/s/commands/cluster_command_test_fixture.cpp
@@ -34,7 +34,6 @@
#include "mongo/s/commands/cluster_command_test_fixture.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/commands/txn_cmds_gen.h"
#include "mongo/db/keys_collection_client_sharded.h"
#include "mongo/db/keys_collection_manager.h"
diff --git a/src/mongo/s/commands/cluster_multicast_cmd.cpp b/src/mongo/s/commands/cluster_multicast_cmd.cpp
index f74c4da2112..974da4fc557 100644
--- a/src/mongo/s/commands/cluster_multicast_cmd.cpp
+++ b/src/mongo/s/commands/cluster_multicast_cmd.cpp
@@ -33,7 +33,6 @@
#include "mongo/base/init.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/executor/async_multicaster.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index c1c7a18e106..12325e975a9 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -44,7 +44,6 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/curop.h"
#include "mongo/db/error_labels.h"
#include "mongo/db/initialize_operation_session_info.h"
diff --git a/src/mongo/util/latch_analyzer_test.cpp b/src/mongo/util/latch_analyzer_test.cpp
index 8105925597a..7f9b21602b5 100644
--- a/src/mongo/util/latch_analyzer_test.cpp
+++ b/src/mongo/util/latch_analyzer_test.cpp
@@ -27,7 +27,6 @@
* it in the license file.
*/
-#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/service_context_test_fixture.h"
#include "mongo/platform/mutex.h"
#include "mongo/platform/source_location.h"