Skip to content

dubbo_proxy: Improved code coverage#7741

Merged
lizan merged 4 commits intoenvoyproxy:masterfrom
gengleilei:feature-improved-coverage
Aug 1, 2019
Merged

dubbo_proxy: Improved code coverage#7741
lizan merged 4 commits intoenvoyproxy:masterfrom
gengleilei:feature-improved-coverage

Conversation

@gengleilei
Copy link
Copy Markdown
Contributor

@gengleilei gengleilei commented Jul 27, 2019

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

Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
@gengleilei gengleilei requested a review from lizan as a code owner July 27, 2019 07:46
@dio
Copy link
Copy Markdown
Member

dio commented Jul 27, 2019

@gengleilei can you check CI? Thanks!

class MockFilterChainFactory : public FilterChainFactory {
public:
MockFilterChainFactory();
~MockFilterChainFactory();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark this override to pass clang-tidy CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks!

.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();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need clearMetadata here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: getActiveMessagesForTest (ForTest is the suffix for test only method)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


for (auto& filter : encoder_filters_) {
// Do not call on destroy twice for dual registered filters.
if (!filter->dual_filter()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use dual_filter_ directly since this is a friend class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not a friend class,this method is needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I thought you made it friend

friend class ActiveResponseDecoder;
but if it's not the case, make it friend, or name this dualFilter

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, i modified it to friend.

@lizan lizan added the waiting label Jul 30, 2019
Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one nit, thanks!
/wait

Event::Dispatcher& dispatcher() override;
void resetStream() override;

bool dual_filter() const { return dual_filter_; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I thought you made it friend

friend class ActiveResponseDecoder;
but if it's not the case, make it friend, or name this dualFilter

Signed-off-by: leilei.gll <leilei.gll@alibaba-inc.com>
@lizan lizan merged commit 2272acc into envoyproxy:master Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants