dubbo_proxy: Improved code coverage#7741
Conversation
Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
|
@gengleilei can you check CI? Thanks! |
| class MockFilterChainFactory : public FilterChainFactory { | ||
| public: | ||
| MockFilterChainFactory(); | ||
| ~MockFilterChainFactory(); |
There was a problem hiding this comment.
mark this override to pass clang-tidy CI.
Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
| .WillOnce(Invoke([&](MessageMetadataSharedPtr, ContextSharedPtr) -> FilterStatus { | ||
| EXPECT_EQ(1, conn_manager_->getActiveMessagesForTesting().size()); | ||
| EXPECT_NE(nullptr, conn_manager_->getActiveMessagesForTesting().front()->metadata()); | ||
| conn_manager_->getActiveMessagesForTesting().front()->clearMetadataForTesting(); |
There was a problem hiding this comment.
why do you need clearMetadata here?
There was a problem hiding this comment.
sorry, i remove the clearMetadataForTesting function because there is no sense of validation.
| bool end_stream); | ||
|
|
||
| // This function is for testing only. | ||
| std::list<ActiveMessagePtr>& getActiveMessagesForTesting() { return active_message_list_; } |
There was a problem hiding this comment.
nit: getActiveMessagesForTest (ForTest is the suffix for test only method)
|
|
||
| for (auto& filter : encoder_filters_) { | ||
| // Do not call on destroy twice for dual registered filters. | ||
| if (!filter->dual_filter()) { |
There was a problem hiding this comment.
You should be able to use dual_filter_ directly since this is a friend class?
There was a problem hiding this comment.
Unlike the http class structure, it is not a friend class.
| Event::Dispatcher& dispatcher() override; | ||
| void resetStream() override; | ||
|
|
||
| bool dual_filter() const { return dual_filter_; } |
There was a problem hiding this comment.
it is not a friend class,this method is needed.
There was a problem hiding this comment.
hmm I thought you made it friend
but if it's not the case, make it friend, or name thisdualFilter
There was a problem hiding this comment.
done, i modified it to friend.
Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
| Event::Dispatcher& dispatcher() override; | ||
| void resetStream() override; | ||
|
|
||
| bool dual_filter() const { return dual_filter_; } |
There was a problem hiding this comment.
hmm I thought you made it friend
but if it's not the case, make it friend, or name thisdualFilter
Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
Description: Improve dubbo_proxy code coverage
Risk Level: Low
Testing: Unit test
Docs Changes: N/A
Release Notes: N/A
Signed-off-by: leilei.gll leilei.gll@alibaba-inc.com