-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: add optional timeouts to waiting for counters/gauges #12251
Conversation
Signed-off-by: Sam Flattery <samflattery@google.com>
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.
Thanks! I think moving to an AssertionResult will end up better than throwing an exception just for test clarity.
test/integration/server.h
Outdated
} | ||
|
||
void waitForCounterGe(const std::string& name, uint64_t value) override { | ||
notifyingStatsAllocator().waitForCounterFromStringGe(name, value); | ||
TestUtility::waitForCounterGe(statStore(), name, value, time_system_); |
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.
Somewhere here we should warn about the default timeout in the comments, because it's opaque that it might throw an exception.
I think it might make more sense to return an AssertionResult
instead of throwing, but calls to these waitFor's will need to be wrapped with ASSERT_TRUE
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.
That makes sense. Might be better to split this up into two functions, say waitForCounterGe
and waitForCounterGeTimeout
since there are dozens of calls to these across all the different tests. The fuzz test is probably the only one that would expect these functions to timeout, say if there is a bug in xDS and the update doesn't properly go through, since mostly they're used to wait for the server to catch up to updates in integration tests. What do you think?
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.
I think that without ABSL_MUST_USE_RESULT
you can ignore the AssertionResult.
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.
Oh right sure, I thought you meant any calls to waitFor would need to be wrapped with ASSERT_TRUE, but I can just do it in the fuzzer. I'll make that change, thanks!
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.
edit: I just moved the assert true to the server stub instead so that all calls will use it
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
test/test_common/utility.h
Outdated
|
||
/** | ||
* Wait for a gauge to >= a given value. | ||
* @param store supplies the stats store. | ||
* @param name gauge name. | ||
* @param value target value. | ||
* @param time_system the time system to use for waiting. | ||
* @param timeout the maximum time to wait before timing out. |
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.
Is there a way to prevent this from using real time? For tests I think we can only safely do this with simulated time. Tests already have a bounded lifetime, so we can rely on that for the real time counter wait timeout.
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.
The main reason for doing this was that the real timeout is something like 5 minutes so debugging is kind of difficult when you have to wait so long to see the logs, etc. I can check to see if I can just condition on whether time_system_ is simulated time or not, but not sure how useful a timeout in simulated time would be. What do you think?
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.
per offline discussion sam's changing the timeout to an optional, so users will fail on timeout only when a timeout param is passed
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
@asraa I made two different implementations (see last two commits), one in which the user has to pass in the timeout every time, and one in which it is a member variable that can be set in the |
Failing extension discovery test which Asra said was flaking |
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
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.
Thanks!
@asraa Still failing extension discovery after merging master, passes locally on |
#12326 |
Signed-off-by: Sam Flattery <samflattery@google.com>
Failing flaking extension discovery service test |
Needs a merge :( |
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.
Thanks!
…y#12251) Commit Message: Add timeouts to waiting for counters/gauges in integration tests add a default timeout of 0s which will not enable the timeout for the existing tests raise an assertionfailure if they timeout Signed-off-by: Sam Flattery <samflattery@google.com>
…y#12251) Commit Message: Add timeouts to waiting for counters/gauges in integration tests add a default timeout of 0s which will not enable the timeout for the existing tests raise an assertionfailure if they timeout Signed-off-by: Sam Flattery <samflattery@google.com> Signed-off-by: chaoqinli <chaoqinli@google.com>
Signed-off-by: Sam Flattery samflattery@google.com
Commit Message: Add timeouts to waiting for counters/gauges
Additional Description:
waitForCounterEq/Ge
to use the same functions aswaitForGaugeEq/Ge
Risk Level: Low
Testing: passes xDS fuzzer tests which make heavy use of these
Docs Changes: N/A
Release Notes: N/A