summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/kv/kv_storage_engine_test.cpp')
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine_test.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
index 6d106ca45c5..b89329fee0f 100644
--- a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
+++ b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
@@ -28,6 +28,7 @@
#include "mongo/platform/basic.h"
+#include "mongo/base/checked_cast.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/db/db_raii.h"
@@ -51,26 +52,13 @@
namespace mongo {
namespace {
-class KVStorageEngineTest : public unittest::Test {
+class KVStorageEngineTest : public ServiceContextMongoDTest {
public:
- enum class RepairAction { kNoRepair, kRepair };
-
KVStorageEngineTest() : KVStorageEngineTest(RepairAction::kNoRepair) {}
- KVStorageEngineTest(RepairAction repair) {
- KVStorageEngineOptions options;
- options.forRepair = (repair == RepairAction::kRepair);
- _storageEngine.reset(new KVStorageEngine(new EphemeralForTestEngine(), options));
- }
-
- void setUp() final {
- _serviceContext.setUp();
- }
-
- void tearDown() final {
- _storageEngine->cleanShutdown();
- _serviceContext.tearDown();
- }
+ KVStorageEngineTest(RepairAction repair)
+ : ServiceContextMongoDTest("ephemeralForTest", repair),
+ _storageEngine(checked_cast<KVStorageEngine*>(getServiceContext()->getStorageEngine())) {}
/**
* Create a collection in the catalog and in the KVEngine. Return the storage engine's `ident`.
@@ -153,8 +141,7 @@ public:
return Status::OK();
}
- ServiceContextMongoDTest _serviceContext;
- std::unique_ptr<KVStorageEngine> _storageEngine;
+ KVStorageEngine* _storageEngine;
};
class KVStorageEngineRepairTest : public KVStorageEngineTest {