Skip to content

test: mock cleanup#7922

Merged
mattklein123 merged 2 commits intoenvoyproxy:masterfrom
alyssawilk:mock_alarm_invoke
Aug 15, 2019
Merged

test: mock cleanup#7922
mattklein123 merged 2 commits intoenvoyproxy:masterfrom
alyssawilk:mock_alarm_invoke

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

Cleanup inspired by #7782 where I had to do a bunch of test cleanup because the tests were calling the callback directly rather than using invokeCallback()

This does lose us a synthetic validation in test/common/network/connection_impl_test.cc which the test admitted could not actually happen and from code inspection has been refactored to no longer look dangerous.

Risk Level: n/a (test only)
Testing: tests pass
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

You are my hero! One question.

/wait-any

attachmentTimeout_timer_ = new NiceMock<Envoy::Event::MockTimer>(&filter_callbacks_.dispatcher_);
EXPECT_CALL(*attachmentTimeout_timer_, enableTimer(config_->attachmentTimeout()))
.WillOnce(Invoke([&](const std::chrono::milliseconds&) {
attachmentTimeout_timer_->enabled_ = true;
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.

Can this actually happen? I don't think so?

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.

I don't think the timer can be invoked literally under enabletimer. My guess is that's the only hook the test author had for squash finishing under async client -> send, but I was mainly trying to preserve existing tests as much as possible.

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.

Do you mind just adding a TODO to fix this test to make it more realistic? Thank you.

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thank you Alyssa!!! :)

@mattklein123 mattklein123 merged commit e64361b into envoyproxy:master Aug 15, 2019
@lizan lizan mentioned this pull request Aug 15, 2019
@alyssawilk alyssawilk deleted the mock_alarm_invoke branch December 9, 2019 21:11
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.

2 participants