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

Add extension functions for modifying a List<DelayController> #1203

Closed
objcode opened this issue May 17, 2019 · 2 comments
Closed

Add extension functions for modifying a List<DelayController> #1203

objcode opened this issue May 17, 2019 · 2 comments

Comments

@objcode
Copy link
Contributor

objcode commented May 17, 2019

Add extension functions for modifying multiple DelayController at once.

Use case: This is useful for advanced testing situations where the interaction of multiple controllers is being tested.

In addition, a lot of early users of the library have shared that they are making multiple TestCoroutineDispatcher instances in a test (i.e. IO, Default, and Main). While the recommended style is to use one TestCoroutineDispatcher unless explicitly testing dispatcher interactions, the ergonomics will be better when tests are written in this style with aggregate extensions.

Depends on idle implementation in #1202 to allow advanceUntilIdle to be implemented.

@elizarov
Copy link
Contributor

We'll need some motivational code example / use-case to get started here.

@objcode
Copy link
Contributor Author

objcode commented May 27, 2019

Agreed - I'm not actually sure this one needs to be part of the library since the use case for advancing time in multiple TCD is unclear.

One option is to ensure the idle implementation in #1202 also allows for a developer to create their own versions. Right now it's not possible to create "correct" aggregate advanceTime* implementations using the interface of DelayController since there is no way to figure out which dispatcher has the "shortest pending delay."

I'd like to leave this ticket open until 1202 is resolved and see if anyone has a more concrete use case.

@qwwdfsad qwwdfsad added the test label Jul 4, 2019
@dkhalanskyjb dkhalanskyjb self-assigned this Oct 11, 2021
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>
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this issue Sep 14, 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
Projects
None yet
Development

No branches or pull requests

4 participants