Skip to content

Commit d82d9ea

Browse files
committed
MB-31869: Remove the MockReplicationThrottle test class
Used in just one test where not really necessary. See https://review.couchbase.org/c/kv_engine/+/134816 for details on when the class was introduced. This is in preparation for removing the base ReplicationThrottle class. Change-Id: Ib58b25023662bfb9181271aa6848145d8b5955cf Reviewed-on: https://review.couchbase.org/c/kv_engine/+/202696 Reviewed-by: Vesko Karaganev <[email protected]> Tested-by: Build Bot <[email protected]> Tested-by: Paolo Cocchi <[email protected]>
1 parent 02ada36 commit d82d9ea

File tree

8 files changed

+1
-95
lines changed

8 files changed

+1
-95
lines changed

engines/ep/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ SET(MOCK_SOURCE
486486
tests/mock/mock_ephemeral_bucket.cc
487487
tests/mock/mock_ephemeral_vb.cc
488488
tests/mock/mock_kvstore.cc
489-
tests/mock/mock_replicationthrottle.cc
490489
tests/mock/mock_stream.cc
491490
tests/mock/mock_synchronous_ep_engine.cc
492491
tests/mock/mock_taskable.cc

engines/ep/tests/mock/mock_ep_bucket.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@
1818
#include "kvstore/kvstore.h"
1919
#include "mock_checkpoint_manager.h"
2020
#include "mock_item_freq_decayer.h"
21-
#include "mock_replicationthrottle.h"
2221
#include "vbucket.h"
2322
#include <executor/executorpool.h>
2423

2524
MockEPBucket::MockEPBucket(EventuallyPersistentEngine& theEngine)
2625
: EPBucket(theEngine) {
27-
// Replace replicationThrottle with Mock to allow controlling when it
28-
// pauses during tests.
29-
replicationThrottle =
30-
std::make_unique<::testing::NiceMock<MockReplicationThrottle>>(
31-
replicationThrottle.release());
3226
ON_CALL(*this, dropKey)
3327
.WillByDefault([this](VBucket& vb,
3428
const DiskDocKey& key,

engines/ep/tests/mock/mock_ephemeral_bucket.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@
1414
#include "ep_engine.h"
1515
#include "failover-table.h"
1616
#include "mock_checkpoint_manager.h"
17-
#include "mock_replicationthrottle.h"
1817
#include "vbucket.h"
1918
#include <executor/executorpool.h>
2019

2120
MockEphemeralBucket::MockEphemeralBucket(EventuallyPersistentEngine& theEngine)
2221
: EphemeralBucket(theEngine) {
23-
// Replace replicationThrottle with Mock to allow controlling when it
24-
// pauses during tests.
25-
replicationThrottle =
26-
std::make_unique<::testing::NiceMock<MockReplicationThrottle>>(
27-
replicationThrottle.release());
2822
}
2923

3024
VBucketPtr MockEphemeralBucket::makeVBucket(

engines/ep/tests/mock/mock_replicationthrottle.cc

Lines changed: 0 additions & 26 deletions
This file was deleted.

engines/ep/tests/mock/mock_replicationthrottle.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

engines/ep/tests/mock/mock_synchronous_ep_engine.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "mock_dcp_conn_map.h"
2121
#include "mock_ep_bucket.h"
2222
#include "mock_ephemeral_bucket.h"
23-
#include "mock_replicationthrottle.h"
2423
#include "objectregistry.h"
2524
#include <executor/executorpool.h>
2625
#include <fmt/format.h>
@@ -276,8 +275,3 @@ DocKey SynchronousEPEngine::public_makeDocKey(CookieIface& cookie,
276275
reinterpret_cast<const uint8_t*>(key.data()), key.size()};
277276
return makeDocKey(cookie, buf);
278277
}
279-
280-
MockReplicationThrottle& SynchronousEPEngine::getMockReplicationThrottle() {
281-
return dynamic_cast<MockReplicationThrottle&>(
282-
kvBucket->getReplicationThrottle());
283-
}

engines/ep/tests/mock/mock_synchronous_ep_engine.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <memory>
2121

22-
struct MockReplicationThrottle;
2322
class SynchronousEPEngine;
2423

2524
using SynchronousEPEngineUniquePtr =
@@ -115,7 +114,6 @@ class SynchronousEPEngine : public EventuallyPersistentEngine {
115114
using EventuallyPersistentEngine::doCollectionStats;
116115
using EventuallyPersistentEngine::doConnAggStats;
117116
using EventuallyPersistentEngine::doEngineStats;
118-
MockReplicationThrottle& getMockReplicationThrottle();
119117

120118
private:
121119
std::unique_ptr<QuotaSharingManager> quotaSharingManager;

engines/ep/tests/module_tests/dcp_durability_stream_test.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
#include "durability/passive_durability_monitor.h"
2727
#include "ep_bucket.h"
2828
#include "kvstore/kvstore.h"
29+
#include "replicationthrottle.h"
2930
#include "test_helpers.h"
3031
#include "vbucket_state.h"
3132
#include "vbucket_utils.h"
3233

3334
#include "../mock/mock_checkpoint_manager.h"
3435
#include "../mock/mock_dcp_consumer.h"
3536
#include "../mock/mock_dcp_producer.h"
36-
#include "../mock/mock_replicationthrottle.h"
3737
#include "../mock/mock_stream.h"
3838
#include "../mock/mock_synchronous_ep_engine.h"
3939

@@ -4379,14 +4379,6 @@ TEST_P(DurabilityPassiveStreamTest,
43794379
Requirements(Level::Majority, Timeout::Infinity()));
43804380
prepare->setBySeqno(prepareSeqno);
43814381

4382-
// We *don't* want the replication throttle to kick in before we attempt
4383-
// to process the prepare, so configure the MockReplicationThrottle to
4384-
// just return "Process" when called during the messageReceived call
4385-
// below.
4386-
using namespace ::testing;
4387-
EXPECT_CALL(engine->getMockReplicationThrottle(), getStatus())
4388-
.WillOnce(Return(ReplicationThrottle::Status::Process));
4389-
43904382
// Message received by stream. Too large for current mem_used so should
43914383
// be buffered and return TMPFAIL
43924384
EXPECT_EQ(cb::engine_errc::temporary_failure,

0 commit comments

Comments
 (0)