Skip to content

Commit 3b525cb

Browse files
BenHuddlestondaverigby
authored andcommitted
MB-41719: Make test_producer_no_stream_end_on_client_close_stream ST
Change-Id: Iabfc0efdc576a354a017f89c2d90a1466d549b44 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/137424 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 92ed049 commit 3b525cb

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

engines/ep/tests/module_tests/dcp_single_threaded_test.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,39 @@ TEST_P(STDcpTest, test_producer_stream_end_on_client_close_stream) {
663663
mockConnMap.manageConnections();
664664
}
665665

666+
/* Checks that the DCP producer does a synchronous stream close when the DCP
667+
client does not expect "DCP_STREAM_END" msg. */
668+
TEST_P(STDcpTest, test_producer_no_stream_end_on_client_close_stream) {
669+
setVBucketStateAndRunPersistTask(vbid, vbucket_state_active);
670+
671+
auto& connMap = engine->getDcpConnMap();
672+
const void* cookie = create_mock_cookie(engine.get());
673+
674+
/* Create a new Dcp producer */
675+
DcpProducer* producer = connMap.newProducer(cookie,
676+
"test_producer",
677+
/*flags*/ 0);
678+
679+
/* Open stream */
680+
EXPECT_EQ(ENGINE_SUCCESS, doStreamRequest(*producer).status);
681+
682+
/* Close stream */
683+
EXPECT_EQ(ENGINE_SUCCESS, producer->closeStream(0, vbid));
684+
685+
/* Don't expect a stream end message (or any other message as the stream is
686+
closed) */
687+
MockDcpMessageProducers producers(engine.get());
688+
EXPECT_EQ(ENGINE_EWOULDBLOCK, producer->step(&producers));
689+
690+
/* Check that the stream is not found in the producer's stream map */
691+
EXPECT_TRUE(producer->findStreams(vbid)->wlock().empty());
692+
693+
/* Disconnect the producer connection */
694+
connMap.disconnect(cookie);
695+
/* Cleanup the deadConnections */
696+
connMap.manageConnections();
697+
}
698+
666699
INSTANTIATE_TEST_SUITE_P(PersistentAndEphemeral,
667700
STDcpTest,
668701
STParameterizedBucketTest::allConfigValues());

engines/ep/tests/module_tests/dcp_test.cc

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,37 +1162,7 @@ TEST_P(ConnectionTest, test_mb17042_duplicate_cookie_producer_connections) {
11621162
}
11631163

11641164

1165-
/* Checks that the DCP producer does a synchronous stream close when the DCP
1166-
client does not expect "DCP_STREAM_END" msg. */
1167-
TEST_P(ConnectionTest, test_producer_no_stream_end_on_client_close_stream) {
1168-
MockDcpConnMap connMap(*engine);
1169-
connMap.initialize();
1170-
const void* cookie = create_mock_cookie(engine);
1171-
1172-
/* Create a new Dcp producer */
1173-
DcpProducer* producer = connMap.newProducer(cookie,
1174-
"test_producer",
1175-
/*flags*/ 0);
1176-
1177-
/* Open stream */
1178-
EXPECT_EQ(ENGINE_SUCCESS, doStreamRequest(*producer).status);
1179-
1180-
/* Close stream */
1181-
EXPECT_EQ(ENGINE_SUCCESS, producer->closeStream(0, vbid));
1182-
1183-
/* Don't expect a stream end message (or any other message as the stream is
1184-
closed) */
1185-
MockDcpMessageProducers producers(handle);
1186-
EXPECT_EQ(ENGINE_EWOULDBLOCK, producer->step(&producers));
11871165

1188-
/* Check that the stream is not found in the producer's stream map */
1189-
EXPECT_TRUE(producer->findStreams(vbid)->wlock().empty());
1190-
1191-
/* Disconnect the producer connection */
1192-
connMap.disconnect(cookie);
1193-
/* Cleanup the deadConnections */
1194-
connMap.manageConnections();
1195-
}
11961166

11971167
TEST_P(ConnectionTest, test_producer_unknown_ctrl_msg) {
11981168
const void* cookie = create_mock_cookie(engine);

0 commit comments

Comments
 (0)