Skip to content

Commit 1656a0d

Browse files
committed
Get rid of real time in TimeoutTest
* To avoid races on very slow Windows-virtualized TC agents
1 parent 298eb11 commit 1656a0d

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

kotlinx-coroutines-core/common/test/flow/operators/TimeoutTest.kt

+3-17
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class TimeoutTest : TestBase() {
154154
}
155155

156156
@Test
157-
fun testUpstreamTimeoutIsolatedContext() = runTest {
157+
fun testUpstreamTimeoutIsolatedContext() = withVirtualTime {
158158
val flow = flow {
159159
assertEquals("upstream", NamedDispatchers.name())
160160
expect(1)
@@ -169,7 +169,7 @@ class TimeoutTest : TestBase() {
169169
}
170170

171171
@Test
172-
fun testUpstreamTimeoutActionIsolatedContext() = runTest {
172+
fun testUpstreamTimeoutActionIsolatedContext() = withVirtualTime {
173173
val flow = flow {
174174
assertEquals("upstream", NamedDispatchers.name())
175175
expect(1)
@@ -187,21 +187,7 @@ class TimeoutTest : TestBase() {
187187
}
188188

189189
@Test
190-
fun testUpstreamNoTimeoutIsolatedContext() = runTest {
191-
val flow = flow {
192-
assertEquals("upstream", NamedDispatchers.name())
193-
expect(1)
194-
emit(1)
195-
expect(2)
196-
delay(10)
197-
}.flowOn(NamedDispatchers("upstream")).timeout(100.milliseconds)
198-
199-
assertEquals(listOf(1), flow.toList())
200-
finish(3)
201-
}
202-
203-
@Test
204-
fun testSharedFlowTimeout() = runTest {
190+
fun testSharedFlowTimeout() = withVirtualTime {
205191
// Workaround for JS legacy bug
206192
try {
207193
MutableSharedFlow<Int>().asSharedFlow().timeout(100.milliseconds).collect()

0 commit comments

Comments
 (0)