Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: mock cleanup #7922

Merged
merged 2 commits into from
Aug 15, 2019
Merged

Conversation

alyssawilk
Copy link
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 <[email protected]>
Copy link
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

@@ -432,8 +432,9 @@ TEST_F(SquashFilterTest, TimerExpiresInline) {
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
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
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
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 <[email protected]>
Copy link
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