Skip to content

Commit

Permalink
SERVER-53141 Initialize Catalog infrastructure in op_msg_fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaimano authored and Evergreen Agent committed Dec 17, 2020
1 parent 4c0bddd commit f6abb42
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mongo/db/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,10 @@ env.Library(
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/auth/authmocks',
'$BUILD_DIR/mongo/db/catalog/catalog_impl',
'$BUILD_DIR/mongo/db/index/index_access_methods',
'$BUILD_DIR/mongo/db/repl/replmocks',
'$BUILD_DIR/mongo/db/s/sharding_api_d',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/service_context_d',
'$BUILD_DIR/mongo/transport/service_entry_point',
Expand Down
18 changes: 18 additions & 0 deletions src/mongo/db/op_msg_fuzzer_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@

#include "mongo/db/auth/authorization_session_for_test.h"
#include "mongo/db/auth/authz_manager_external_state_local.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/collection_impl.h"
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/catalog/database_holder_impl.h"
#include "mongo/db/client.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_access_method_factory_impl.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/s/collection_sharding_state_factory_standalone.h"
#include "mongo/db/service_entry_point_common.h"
#include "mongo/db/service_entry_point_mongod.h"
#include "mongo/db/storage/storage_engine_mock.h"
#include "mongo/db/vector_clock_mutable.h"
#include "mongo/transport/service_entry_point_impl.h"

Expand All @@ -58,6 +66,16 @@ OpMsgFuzzerFixture::OpMsgFuzzerFixture(bool skipGlobalInitializers) {

_clientStrand = ClientStrand::make(_serviceContext->makeClient("test", _session));

_serviceContext->setStorageEngine(std::make_unique<StorageEngineMock>());

CollectionShardingStateFactory::set(
_serviceContext,
std::make_unique<CollectionShardingStateFactoryStandalone>(_serviceContext));
DatabaseHolder::set(_serviceContext, std::make_unique<DatabaseHolderImpl>());
IndexAccessMethodFactory::set(_serviceContext,
std::make_unique<IndexAccessMethodFactoryImpl>());
Collection::Factory::set(_serviceContext, std::make_unique<CollectionImpl::FactoryImpl>());

auto localExternalState = std::make_unique<AuthzManagerExternalStateMock>();
_externalState = localExternalState.get();

Expand Down

0 comments on commit f6abb42

Please sign in to comment.