-
Notifications
You must be signed in to change notification settings - Fork 5.3k
test: more fast-timeouts. #15959
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: more fast-timeouts. #15959
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,11 +69,19 @@ AssertionResult IntegrationStreamDecoder::waitForEndStream(std::chrono::millisec | |
| return AssertionSuccess(); | ||
| } | ||
|
|
||
| void IntegrationStreamDecoder::waitForReset() { | ||
| AssertionResult IntegrationStreamDecoder::waitForReset(std::chrono::milliseconds timeout) { | ||
| if (!saw_reset_) { | ||
| // Set a timer to stop the dispatcher if the timeout has been exceeded. | ||
| Event::TimerPtr timer(dispatcher_.createTimer([this]() -> void { dispatcher_.exit(); })); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment on how this works (or this is a common pattern?), it took me a minute. If it is a common pattern, can we extract this to some helper? Also might want to note somewhere that this leaves the dispatcher in a bad state so you really want ASSERT vs EXPECT
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it leaves the dispatcher in a bad state, what do you think the problem is?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm probably misunderstanding how this works, but seems to me like this stops the dispatcher after the timer expires? It would then mean that it's no longer running after this? But on the other hand we don't disable this so this will fire on its own at some point anyways, so I guess it can't be messing up the dispatcher. So what exactly does calling
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, the dispatcher below is run in blocking mode, so it will loop for ever unless something tells it to exit. |
||
| timer->enableTimer(timeout); | ||
| waiting_for_reset_ = true; | ||
| dispatcher_.run(Event::Dispatcher::RunType::Block); | ||
| // If the timer has fired, this timed out before a reset was received. | ||
| if (!timer->enabled()) { | ||
| return AssertionFailure() << "Timed out waiting for reset."; | ||
| } | ||
| } | ||
| return AssertionSuccess(); | ||
| } | ||
|
|
||
| void IntegrationStreamDecoder::decode100ContinueHeaders(Http::ResponseHeaderMapPtr&& headers) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must use result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean
ABSL_MUST_USE_RESULT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, seems like we want callers to check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, maybe I can on this one - I couldn't on the other one I ported without changing signature, updating envoy filter examples, and then adding MUST_USE but I think Enovy filter examples doens't use this function