Skip to content

Commit 6e11dc8

Browse files
committed
MB-51413: Create MockCouchKVStore in replaceCouchKVStore
It's test code so the greater flexibility is useful. Change-Id: Ib76d1c35b85db9d9e725b2fde6bbd11f42824ae1 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/172221 Tested-by: Ben Huddleston <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 785dcc6 commit 6e11dc8

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

engines/ep/tests/mock/mock_couch_kvstore.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class MockCouchKVStore : public CouchKVStore {
6666
: CouchKVStore(config) {
6767
}
6868

69+
MockCouchKVStore(const CouchKVStoreConfig& config, FileOpsInterface& ops)
70+
: CouchKVStore(config, ops) {
71+
}
72+
6973
/// Read-Only constructor where we are given a RevisionMap
7074
MockCouchKVStore(const CouchKVStoreConfig& config,
7175
std::shared_ptr<RevisionMap> dbFileRevMap)

engines/ep/tests/module_tests/kv_bucket_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "lambda_task.h"
4242
#include "replicationthrottle.h"
4343
#include "tasks.h"
44+
#include "tests/mock/mock_couch_kvstore.h"
4445
#include "tests/mock/mock_global_task.h"
4546
#include "tests/mock/mock_synchronous_ep_engine.h"
4647
#include "tests/module_tests/test_helpers.h"
@@ -494,7 +495,7 @@ void KVBucketTest::replaceCouchKVStore(FileOpsInterface& ops) {
494495
ASSERT_EQ(engine->getConfiguration().getBackend(), "couchdb");
495496

496497
const auto& config = store->getRWUnderlying(vbid)->getConfig();
497-
auto rw = std::make_unique<CouchKVStore>(
498+
auto rw = std::make_unique<MockCouchKVStore>(
498499
dynamic_cast<const CouchKVStoreConfig&>(config), ops);
499500

500501
const auto shardId = store->getShardId(vbid);

engines/ep/tests/module_tests/kv_bucket_test.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ class KVBucketTest : virtual public ::testing::Test {
314314
Collections::Manager& getCollectionsManager();
315315

316316
/**
317-
* Replace the r/w KVStore with one that uses the given ops. This function
318-
* will test the config to be sure the KVBucket is persistent/couchstore.
317+
* Replace the r/w KVStore with a MockCouchKVStore that uses the given ops.
318+
* This function will test the config to be sure the KVBucket is
319+
* persistent/couchstore.
319320
*/
320321
void replaceCouchKVStore(FileOpsInterface& ops);
321322

0 commit comments

Comments
 (0)