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

runBlockingTest raises job has not completed yet with Futures #1395

Closed
powturns opened this issue Jul 29, 2019 · 1 comment
Closed

runBlockingTest raises job has not completed yet with Futures #1395

powturns opened this issue Jul 29, 2019 · 1 comment
Assignees
Labels

Comments

@powturns
Copy link

@powturns powturns commented Jul 29, 2019

The following code will raise a "This job has not completed yet" exception

    @Test
    fun testFuture() = runBlockingTest {
        try {
            CompletableFuture.supplyAsync {
                Thread.sleep(1000)
                throw RuntimeException("Async Exception")
            }.await()
            fail("Expected Exception not thrown")
        } catch (e: RuntimeException) {
            //noop
        }
    }

I believe it is because advanceUntilIdle() doesn't wait for the future to complete because the async behaviour is kicked off from outside of the coroutines.

This may be related to some of the other "This job has not completed yet" issues, but I don't have enough experience to evaluate.

@qwwdfsad qwwdfsad added the test label Jul 29, 2019
@qwwdfsad
Copy link
Member

@qwwdfsad qwwdfsad commented Jul 29, 2019

This is being fixed in #1206

@qwwdfsad qwwdfsad self-assigned this Feb 18, 2020
dkhalanskyjb added a commit that referenced this issue Nov 1, 2021
Implement a multiplatform runTest as an initial implementation of #1996.

Fixes #1204
Fixes #1222
Fixes #1395
Fixes #1881
Fixes #1910
Fixes #1772
dkhalanskyjb added a commit that referenced this issue Nov 17, 2021
Implement a multiplatform runTest as an initial implementation of #1996.

Fixes #1204
Fixes #1222
Fixes #1395
Fixes #1881
Fixes #1910
Fixes #1772
dkhalanskyjb added a commit that referenced this issue Nov 17, 2021
Implement a multiplatform runTest as an initial implementation of #1996.

Fixes #1204
Fixes #1222
Fixes #1395
Fixes #1881
Fixes #1910
Fixes #1772
dkhalanskyjb added a commit that referenced this issue Nov 19, 2021
Implement a multiplatform runTest as an initial implementation of #1996.

Fixes #1204
Fixes #1222
Fixes #1395
Fixes #1881
Fixes #1910
Fixes #1772
yorickhenning pushed a commit to yorickhenning/kotlinx.coroutines that referenced this issue Jan 28, 2022
This commit introduces the new version of the test module.
Please see README.md and MIGRATION.md for a thorough
discussion of the changes.

Fixes Kotlin#1203
Fixes Kotlin#1609
Fixes Kotlin#2379
Fixes Kotlin#1749
Fixes Kotlin#1204
Fixes Kotlin#1390
Fixes Kotlin#1222
Fixes Kotlin#1395
Fixes Kotlin#1881
Fixes Kotlin#1910
Fixes Kotlin#1772
Fixes Kotlin#1626
Fixes Kotlin#1742
Fixes Kotlin#2082
Fixes Kotlin#2102
Fixes Kotlin#2405
Fixes Kotlin#2462

Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants