Skip to content

CoroutinesTimeout dumps too few jobs #1542

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

Closed
cy6erGn0m opened this issue Sep 17, 2019 · 0 comments
Closed

CoroutinesTimeout dumps too few jobs #1542

cy6erGn0m opened this issue Sep 17, 2019 · 0 comments
Assignees

Comments

@cy6erGn0m
Copy link
Contributor

CoroutinesTimeout rule doesn't capture some coroutines started during a test since the coroutines dump magic installation is too late.

Running the following test (should always fail with timeout) produces coroutines dump with only "job2" and no "job1".

import kotlinx.coroutines.*
import kotlinx.coroutines.debug.junit4.*
import org.junit.*

class DumpTest {
    @get:Rule
    val timeout: CoroutinesTimeout = CoroutinesTimeout.seconds(1)

    private val coroutine = GlobalScope.launch(CoroutineName("job1")) {
        coroutineContext[Job]!!.join() // hang forever
    }

    @Test
    fun test(): Unit = runBlocking(CoroutineName("job2")) {
        coroutine.join()
    }
}
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