chore: handle FlowControllerTest thread start variation by polling#1586
chore: handle FlowControllerTest thread start variation by polling#1586burkedavison merged 6 commits intomainfrom
Conversation
|
@suztomo , @blakeli0 , and/or @meltsufin : PTAL when you have a moment. |
gax-java/gax/src/test/java/com/google/api/gax/batching/FlowControllerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/batching/AssertByPollingTest.java
Outdated
Show resolved
Hide resolved
| Stopwatch stopwatch = Stopwatch.createStarted(); | ||
| while (true) { | ||
| try { | ||
| assertion.run(); |
There was a problem hiding this comment.
Nice to have: Inspired by your test, maybe we can have a counter that counts how many times we tried before a successful assertion?
There was a problem hiding this comment.
What do you have in mind for how it would be used? When successful, it currently proceeds without logging anything.
There was a problem hiding this comment.
What do you have in mind for how it would be used? When successful, it currently proceeds without logging anything.
We can add logs to show that how many times we tried when successful, so that it could be useful if we want to check previously successful runs.
There was a problem hiding this comment.
I smell YAGNI here.
When we really want to measure certain operations, I think we would write a simple Java code to run the operation. Then we would run it against old code by checking out release tags via Git.
gax-java/gax/src/test/java/com/google/api/gax/batching/AssertByPolling.java
Outdated
Show resolved
Hide resolved
|
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed!
|
|
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed!
|
|
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed!
|








Fixes #1286
Issue: "Expected thread to be WAITING (blocked) but instead was RUNNABLE (had not been started yet, or had not yet reached the blocking logic.)"
This PR increases the amount of time spent waiting for the thread to be blocked, while also implementing a polling assertion mechanism to prevent waiting the maximum amount of time.
Also: Raw types fixed in this file.