summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context_d_test_fixture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/service_context_d_test_fixture.cpp')
-rw-r--r--src/mongo/db/service_context_d_test_fixture.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/service_context_d_test_fixture.cpp b/src/mongo/db/service_context_d_test_fixture.cpp
index 8f444a5a17c..5eec5cb6a24 100644
--- a/src/mongo/db/service_context_d_test_fixture.cpp
+++ b/src/mongo/db/service_context_d_test_fixture.cpp
@@ -51,11 +51,16 @@ namespace mongo {
ServiceContextMongoDTest::ServiceContextMongoDTest()
: ServiceContextMongoDTest("ephemeralForTest") {}
-ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine) {
+ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine)
+ : ServiceContextMongoDTest(engine, RepairAction::kNoRepair) {}
+
+ServiceContextMongoDTest::ServiceContextMongoDTest(std::string engine, RepairAction repair) {
_stashedStorageParams.engine = std::exchange(storageGlobalParams.engine, std::move(engine));
_stashedStorageParams.engineSetByUser =
std::exchange(storageGlobalParams.engineSetByUser, true);
+ _stashedStorageParams.repair =
+ std::exchange(storageGlobalParams.repair, (repair == RepairAction::kRepair));
auto const serviceContext = getServiceContext();
serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongod>(serviceContext));
@@ -86,6 +91,7 @@ ServiceContextMongoDTest::~ServiceContextMongoDTest() {
shutdownGlobalStorageEngineCleanly(getGlobalServiceContext());
std::swap(storageGlobalParams.engine, _stashedStorageParams.engine);
std::swap(storageGlobalParams.engineSetByUser, _stashedStorageParams.engineSetByUser);
+ std::swap(storageGlobalParams.repair, _stashedStorageParams.repair);
}
} // namespace mongo