-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Have the global timeout take into account t.timeout()
durations
#2384
Comments
t.timeout
override default timeout from 3.0.0 release: t.timeout
be changed to override the global timeout?
The global timeout is a "stop tests in case they're stuck" kind of timeout. I suppose we could interpret that as "stop tests in case they're stuck, but don't worry for the next 30 seconds since the test will fail if it's stuck anyway". The workers will have to send a message to the main process whenever a per-test timeout starts, with the timeout duration. And then in the main process we'd have to make sure we don't stop tests because they're stuck until that duration has passed. This should work with multiple I don't think it's quite a one-liner, but this approach is consistent with what the global timeout is there for, so let's do it. |
t.timeout
be changed to override the global timeout?t.timeout()
durations
How is described behavior different from removing the global timeout and setting a default timeout on every test? Basically,
The net effect is the same IMHO. |
When tests run concurrently, within and across worker processes, their duration may vary wildly. The global timeout (misnamed as it may be) is only concerned with making sure something is happening in your test suite. Individual timeouts can be useful in certain cases, but far from all. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I've opened #2421 to track. I'm going to mark our conversation here as "off-topic", so it doesn't distract from what this issue is hoping to address. |
I just ran into this, and it took longer than I'd like to admit to realize this was the issue. We have two tests that are much slower (~2m), while the other tests are below the default 10s. I wanted to only mark to "slow" tests to use a higher timeout, instead of needing to set Would be awesome to have this issue solved! 😄 |
@csvn would you be interested in taking this on? |
- use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; they only decrease the timeout. So, they are currently worthless for modifying longer tests. * ref: <avajs/ava#2384>
- use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; they only decrease the timeout. So, they are currently worthless for modifying longer tests. * ref: <avajs/ava#2384>
- use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; they only decrease the timeout. So, they are currently worthless for modifying longer tests. * ref: <avajs/ava#2384>
- use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; they only decrease the timeout. So, they are currently worthless for modifying longer tests. * ref: <avajs/ava#2384>
- use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; they only decrease the timeout. So, they are currently worthless for modifying longer tests. * ref: <avajs/ava#2384>
Any news on this? @novemberborn @csvn ? I'd be willing to draft a PR if nobody is on it yet. But honestly I still don't grok the reason behind the current implementation. Like the docs say, "Timeouts in AVA behave differently than in other test frameworks." – and I fail to understand why that's desirable. To me:
As a user of the framework, not interested in implementation details, I would expect (similar to @sramam I think):
@novemberborn could you maybe try to shed some more light on the design decisions behind the timeout mechanisms? Sorry for being a bit slow here …
Could you please elaborate on this one? |
@stefanpl the solution outlined in #2384 (comment) addresses your concerns. PR still welcome. I don't think hard timeouts are necessary for most use cases. Test performance is easily influenced by the load on the executing machine. |
apowerful1 has contributed $40.00 to this issue on Rysolv. |
Hey there, I came in after seeing the issue on Rysolv. Seeing nobody else has announced of them picking this up, guess I'll give it a try. As per my understanding after some local testing: Presently, |
@OhYash great! Let me know if I can help. |
Hey @novemberborn, gave it some more time today. I could use some help actually. So, we have this restartTimer debounce() function that has the single delay to it, which emits state change upon the timeout and adds pending workers to timedOutWorkerFiles. |
I think you'd have to add a callback or event emitter to
(I don't think this would be considered a state change, but also it's already overloaded so I guess it's fine.) You can now connect it up to the API code, where you have access to the timeouts: Line 234 in b8f5685
|
Hey @novemberborn, sorry for being so silent. Wasn't my intention to ghost away. Just got carried away in some stuff. So regarding this, I've managed to get the individual timeout into Any way I can update the debounce wait? |
Besides that I think I also see an issue, kinda unrelated. Tests can run asynchronously, but timers are synchronous. For example: Forget about the
gist: https://gist.github.com/OhYash/7f34ac6701a699d5e09537b4e6a054e9 |
@OhYash could you share a draft PR? |
@novemberborn, Linked #2758 |
Fixes #2384. Co-authored-by: Mark Wubben <mark@novemberborn.net>
What you're trying to do
I appreciate that having a global timeout in order to catch unexpected behavior in a test and not consume too much CI resources. However, some tests take a long time intentionally, and I would like to be able to use
t.timeout()
to explicitly override the global timeouts for just one test. Right now, you can only override the global timeouts if thent.timeout()
is shorter than the global timeout. It would be nice if it overrides whent.timeout()
is longer as well.I think I am not the only one, as I found this question referring to the same problem.
Why you can't use AVA for this
There is no way to have a global timeout that is something like 10s and a timeout for a particular test that is longer, like 30s.
And maybe how you think AVA could handle this
I'm not sure how the timeouts are coded, it might be a one-liner :)
The text was updated successfully, but these errors were encountered: