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

Await AtMost Until - Never Times Out #237

Open
helloworldless opened this issue Feb 16, 2022 · 1 comment
Open

Await AtMost Until - Never Times Out #237

helloworldless opened this issue Feb 16, 2022 · 1 comment

Comments

@helloworldless
Copy link

helloworldless commented Feb 16, 2022

I have a simple use case: an adapter which uses Spring's RestTemplate. I know that RestTemplate, like many HTTP clients, does not set a timeout by default. So it can theoretically sit there spinning forever and tie up resources not to mention the caller.

So I thought, let me add a test with awailability to prove this. The test should fail. Then I'll add a timeout to RestTemplate and prove that it fixes the test.

Here's the thing: using org.awaitility:awaitility:4.1.1, I could not get the test to fail! It just never times out.

I thought I was going crazy, so I downgraded to org.awaitility:awaitility:3.1.6, and then it worked!

This is what the test is doing:

await().atMost(1, SECONDS).until(() ->
    adapterWithNoTimeout.makeRequest() == null
);

I hope it's not some obvious change from v3 to v4 that I've missed. Still it seems odd that a basic behavior like this would be changed even across major versions.

@TheNitek
Copy link

TheNitek commented Mar 4, 2022

Looks like this issue: #234

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

No branches or pull requests

2 participants