[
https://issues.apache.org/jira/browse/GROOVY-12788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152752#comment-18152752
]
ASF GitHub Bot commented on GROOVY-12788:
-----------------------------------------
testlens-app[bot] commented on PR #3380:
URL: https://github.com/apache/groovy/pull/3380#issuecomment-7274589490
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3380`
#### [Build and test / lts \(17,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/46390639136/job/141751925530?pr=3380)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| RegressionTest > testGroovy12788\(\) | ❌ | 0% 🟢 |
🏷️ Commit: 4c41fb1d119de80af8fa3fd60b7624ee0f56615d
▶️ Tests: 26111 executed
🟡 Checks: 7/25 completed
### Test Failures
<details><summary><strong>RegressionTest > testGroovy12788()</strong> (:test
in <a
href="https://github.com/apache/groovy/actions/runs/46390639136/job/141751925530?pr=3380">Build
and test / lts (17, ubuntu-latest)</a>)</summary>
```
java.lang.AssertionError: Method is marked with @NotYetImplemented but
passes unexpectedly
at bugs.RegressionTest.testGroovy12788(RegressionTest.groovy:5715)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 RegressionTest > testGroovy12788\(\) <!
> Awaitable.all() and await(a, b) do not fail fast as documented
> --------------------------------------------------------------
>
> Key: GROOVY-12788
> URL: https://issues.apache.org/jira/browse/GROOVY-12788
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 6.0.0
> Reporter: Stephen Albrecht
> Priority: Major
>
> Environment: Groovy 6.0.0, JDK 25.0.1
> The
> [JavaDoc|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/groovy/concurrent/Awaitable.java#L402-L404]
> for Awaitable.all() states "Like JavaScript's Promise.all(), the combined
> awaitable fails as soon as the first source fails."
> However, Awaitable.all() waits for every source to complete before failing.
> The implementation in
> [AwaitCombinators.allAsync|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/org/apache/groovy/runtime/async/AwaitCombinators.java#L84-L85]
> is built on CompletableFuture.allOf(), whose JavaDoc states "Returns a new
> CompletableFuture that is completed when all of the given CompletableFutures
> complete. If any of the given CompletableFutures complete exceptionally, then
> the returned CompletableFuture also does so". allOf() therefore isn't
> fail-fast.
> await(a, b) is affected too.
> {code:java}
> import groovy.concurrent.Awaitable
> def time = { String label, Closure body ->
> def start = System.currentTimeMillis()
> try {
> body()
> } catch (e) {
> println "$label threw after ${System.currentTimeMillis() - start}ms"
> }
> }
> time('Awaitable.all') {
> await Awaitable.all(
> async { Thread.sleep(3000) },
> async { throw new RuntimeException('fail') }
> )
> }
> time('await(a, b)') {
> await(
> async { Thread.sleep(3000) },
> async { throw new RuntimeException('fail') }
> )
> }
> {code}
> {code:java}
> Awaitable.all threw after 3005ms
> await(a, b) threw after 3004ms{code}
> Expected: both throw after ~0ms (the second source fails immediately)
> Actual: both throw after 3000ms (once the first source completes)
> allAsync() already [hooks a callback onto every source that runs on
> failure|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/org/apache/groovy/runtime/async/AwaitCombinators.java#L79],
> so it can probably just return the failure immediately with
> result.completeExceptionally(asCompletionException(error)) and keep
> CompletableFuture.allOf() for the success case.
> This would match the Promise.all() behavior which doesn't cancel the
> remaining sources.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)