Repository: ktorio/ktor
File: ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/HttpTimeoutTest.kt (Kotlin)

Code before:
        config {
            install(HttpTimeout)
        }

        test { client ->
            val response = client.request("$TEST_URL/with-delay") {
                method = HttpMethod.Get
                parameter("delay", 10)

                timeout { requestTimeoutMillis = 1000 }
            }
            val result: String = response.body()

            assertEquals("Text", result)
        }
    }

    @Test
    fun testGetRequestTimeoutWithSeparateReceive() = clientTests(except("Js"), retries = 5) {
        config {
            install(HttpTimeout) { requestTimeoutMillis = 1000 }
        }

        test { client ->
            val response = client.prepareRequest("$TEST_URL/with-stream") {
                method = HttpMethod.Get
                parameter("delay", 500)
            }.body<ByteReadChannel>()

            assertFailsWith<CancellationException> {
                response.readUTF8Line()
            }
        }
    }

    @Test
    fun testGetRequestTimeoutWithSeparateReceivePerRequestAttributes() = clientTests(
        except("Js", "Darwin", "DarwinLegacy")
    ) {
        config {
            install(HttpTimeout)
        }

        test { client ->
            val response = client.prepareRequest("$TEST_URL/with-stream") {
                method = HttpMethod.Get
                parameter("delay", 10000)

                timeout { requestTimeoutMillis = 2000 }
            }.body<ByteReadChannel>()
            assertFailsWith<CancellationException> {

Review comment (suggestion):
Tried to rerun tests several times on CI and they always were successful. So removed this `if`

Code after:

    @Test
    fun testGetWithSeparateReceivePerRequestAttributes() = clientTests {
        config {
            install(HttpTimeout)
        }

        test { client ->
            val response = client.request("$TEST_URL/with-delay") {
                method = HttpMethod.Get
                parameter("delay", 10)

                timeout { requestTimeoutMillis = 1000 }
            }
            val result: String = response.body()

            assertEquals("Text", result)
        }
    }

    @Test
    fun testGetRequestTimeoutWithSeparateReceive() = clientTests(except("Js"), retries = 5) {
        config {
            install(HttpTimeout) { requestTimeoutMillis = 1000 }
        }

        test { client ->
            val response = client.prepareRequest("$TEST_URL/with-stream") {
                method = HttpMethod.Get
                parameter("delay", 500)
            }.body<ByteReadChannel>()

            assertFailsWith<CancellationException> {
                response.readUTF8Line()
            }
        }
    }

    @Test
    fun testGetRequestTimeoutWithSeparateReceivePerRequestAttributes() = clientTests(
        except(ENGINES_WITHOUT_REQUEST_TIMEOUT, "Js", "Darwin", "DarwinLegacy")
    ) {
        config {
            install(HttpTimeout)
        }

        test { client ->
            val response = client.prepareRequest("$TEST_URL/with-stream") {
                method = HttpMethod.Get
                parameter("delay", 10000)