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

[Enhancement]: Timeout for wait strategies #1011

Closed
maaex opened this issue Oct 3, 2023 · 2 comments
Closed

[Enhancement]: Timeout for wait strategies #1011

maaex opened this issue Oct 3, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@maaex
Copy link
Contributor

maaex commented Oct 3, 2023

Problem

There currently seems to be no timeout on wait strategies leading to the possibility of a test getting stuck in an endless wait.

Solution

The WaitStrategy.WaitUntilAsync method already has a Timeout argument. Currently the call to it is hardcoded to Timeout.InfiniteTimeSpan. I propose making it configurable for the user, possibly by adding a Timeout property to the IWaitUntil interface.

Benefit

This would give the user a fail-safe by allowing configurable timeouts WaitStrategies

Alternatives

One alternative could be to change the current WaitStrategy from Infinite to some long number, though I think its hard to find a good number here due to the numerous use cases.

Another alternative could be to rely on the testing frameworks' timeouts.

Would you like to help contributing this enhancement?

Yes

@maaex maaex added the enhancement New feature or request label Oct 3, 2023
@HofmeisterAn
Copy link
Collaborator

There currently seems to be no timeout on wait strategies leading to the possibility of a test getting stuck in an endless wait.

You can pass a cancellation token to the container's start method like this:

I began working on improving the wait strategy API and adding more convenient features some time ago, but I haven't had the time to finalize and review it (refactor-wait-strategy-api). This issue is related to #827. I would prefer to continue the discussion in this issue to maintain clarity and avoid losing track.

@maaex maaex closed this as completed Oct 4, 2023
@maaex
Copy link
Contributor Author

maaex commented Oct 4, 2023

You can pass a cancellation token to the container's start method like this:

Thanks, I didn't realize this existed. That will be enough to solve the issue in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants