Skip to content

Commit 2d0b7f1

Browse files
committed
Fix flaky tests
1 parent e449267 commit 2d0b7f1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

krpc/krpc-ktor/krpc-ktor-core/src/jvmTest/kotlin/kotlinx/rpc/krpc/ktor/KtorTransportTest.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package kotlinx.rpc.krpc.ktor
99
import io.ktor.client.*
1010
import io.ktor.client.engine.cio.*
1111
import io.ktor.client.plugins.HttpRequestRetry
12+
import io.ktor.client.plugins.HttpTimeout
1213
import io.ktor.client.request.*
1314
import io.ktor.client.statement.*
1415
import io.ktor.server.application.*
@@ -188,6 +189,9 @@ class KtorTransportTest {
188189
retryOnServerErrors(maxRetries = 5)
189190
exponentialDelay()
190191
}
192+
install(HttpTimeout) {
193+
requestTimeoutMillis = 10000
194+
}
191195

192196
installKrpc {
193197
serialization {
@@ -296,6 +300,9 @@ class KtorTransportTest {
296300
retryOnServerErrors(maxRetries = 5)
297301
exponentialDelay()
298302
}
303+
install(HttpTimeout) {
304+
requestTimeoutMillis = 10000
305+
}
299306

300307
installKrpc {
301308
serialization {

krpc/krpc-test/src/commonTest/kotlin/kotlinx/rpc/krpc/test/BackPressureTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class BackPressureTest : BackPressureTestBase() {
9090
abstract class BackPressureTestBase {
9191
protected fun runServerTest(
9292
perCallBufferSize: Int,
93-
timeout: Duration = 30.seconds,
93+
timeout: Duration = 120.seconds,
9494
) = runTest(perCallBufferSize, timeout) { service, impl ->
9595
var counter = 0
9696
val flowList = async {
@@ -123,7 +123,7 @@ abstract class BackPressureTestBase {
123123

124124
protected fun runClientTest(
125125
perCallBufferSize: Int,
126-
timeout: Duration = 30.seconds,
126+
timeout: Duration = 120.seconds,
127127
) = runTest(perCallBufferSize, timeout) { service, impl ->
128128
var counter = 0
129129
val flowList = async {

tests/krpc-protocol-compatibility-tests/src/test/kotlin/kotlinx/rpc/krpc/test/compat/KrpcProtocolCompatibilityTestsBase.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ abstract class KrpcProtocolCompatibilityTestsBase {
104104

105105
private fun testOldClientWithNewServer(
106106
perCallBufferSize: Int = 1,
107-
timeout: Duration = 10.seconds,
107+
timeout: Duration = 60.seconds,
108108
exclude: List<Versions>,
109109
body: suspend TestEnv.(CompatService, CompatServiceImpl) -> Unit,
110110
) = runTest(Role.Client, exclude, timeout) {
@@ -117,7 +117,7 @@ abstract class KrpcProtocolCompatibilityTestsBase {
117117

118118
private fun testOldServersWithNewClient(
119119
perCallBufferSize: Int = 1,
120-
timeout: Duration = 10.seconds,
120+
timeout: Duration = 60.seconds,
121121
exclude: List<Versions>,
122122
body: suspend TestEnv.(CompatService, CompatServiceImpl) -> Unit,
123123
) = runTest(Role.Server, exclude, timeout) {
@@ -130,7 +130,7 @@ abstract class KrpcProtocolCompatibilityTestsBase {
130130

131131
protected fun matrixTest(
132132
perCallBufferSize: Int = 1,
133-
timeout: Duration = 10.seconds,
133+
timeout: Duration = 60.seconds,
134134
exclude: List<VersionRolePair> = emptyList(),
135135
body: suspend TestEnv.(CompatService, CompatServiceImpl) -> Unit,
136136
): Stream<DynamicTest> {

0 commit comments

Comments
 (0)