Commit e73740d
authored
fix: Fix flaky test ScheduledRetryingExecutorTest.testCancelOuterFutureAfterStart (#3335)
The test was flaky because the
[Thread.sleep(150)](https://github.com/googleapis/sdk-platform-java/blob/b031b18a9bb35b77ca21d3665217aa4c219ced57/gax-java/gax/src/test/java/com/google/api/gax/retrying/ScheduledRetryingExecutorTest.java#L288)
does not guarantee the main thread would wake up after exactly 150ms, it
might take much longer if the resource is limited on the machine or we
are running tests in parallel.
Hence if the thread sleeps more than
[1525ms](https://github.com/googleapis/sdk-platform-java/blob/0cddadb8ad3eddfffa356a479964d8a720937503/gax-java/gax/src/test/java/com/google/api/gax/retrying/ScheduledRetryingExecutorTest.java#L262),
the future would be completed already, and the cancellation of the
future would result in false.
Update the total request duration to 32500ms now, it is still not bullet
proof but we would have much less chance to run into flaky tests now.
fixes: #26691 parent 0cddadb commit e73740d
File tree
1 file changed
+6
-5
lines changed- gax-java/gax/src/test/java/com/google/api/gax/retrying
1 file changed
+6
-5
lines changedLines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
| 263 | + | |
263 | 264 | | |
264 | | - | |
265 | | - | |
| 265 | + | |
| 266 | + | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| |||
0 commit comments