From 9e46cd2ff66d6bfdc0430b0efa9877a27453425c Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Sat, 30 Jan 2021 19:12:43 +1100 Subject: [PATCH] fix(test): drain connection in more pullfilerequest tests --- .../adam/request/sync/compat/CompatPullFileRequestTest.kt | 7 +++++++ .../malinskiy/adam/request/sync/v1/PullFileRequestTest.kt | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/com/malinskiy/adam/request/sync/compat/CompatPullFileRequestTest.kt b/src/test/kotlin/com/malinskiy/adam/request/sync/compat/CompatPullFileRequestTest.kt index ad4cc8f18..6d3706d73 100644 --- a/src/test/kotlin/com/malinskiy/adam/request/sync/compat/CompatPullFileRequestTest.kt +++ b/src/test/kotlin/com/malinskiy/adam/request/sync/compat/CompatPullFileRequestTest.kt @@ -21,6 +21,7 @@ import assertk.assertions.isEqualTo import com.malinskiy.adam.Const import com.malinskiy.adam.request.Feature import com.malinskiy.adam.server.AndroidDebugBridgeServer +import io.ktor.utils.io.* import kotlinx.coroutines.channels.receiveOrNull import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking @@ -62,6 +63,9 @@ class CompatPullFileRequestTest { output.respondData(fixture.readBytes()) output.respondDone() output.respondDone() + + output.close() + input.discard() } val request = CompatPullFileRequest("/sdcard/testfile", tempFile, emptyList(), this) @@ -109,6 +113,9 @@ class CompatPullFileRequestTest { output.respondData(fixture.readBytes()) output.respondDone() output.respondDone() + + output.close() + input.discard() } val request = CompatPullFileRequest("/sdcard/testfile", tempFile, listOf(Feature.SENDRECV_V2), this) diff --git a/src/test/kotlin/com/malinskiy/adam/request/sync/v1/PullFileRequestTest.kt b/src/test/kotlin/com/malinskiy/adam/request/sync/v1/PullFileRequestTest.kt index f65c4b2ab..aa52e02d0 100644 --- a/src/test/kotlin/com/malinskiy/adam/request/sync/v1/PullFileRequestTest.kt +++ b/src/test/kotlin/com/malinskiy/adam/request/sync/v1/PullFileRequestTest.kt @@ -37,10 +37,6 @@ class PullFileRequestTest { @JvmField val temp = TemporaryFolder() -// @Rule -// @JvmField -// val coroutines = CoroutinesTimeout.seconds(5) - @Test fun testSerialize() { assertThat(String(PullFileRequest("/sdcard/testfile", File("/tmp/testfile")).serialize(), Const.DEFAULT_TRANSPORT_ENCODING)) @@ -129,6 +125,9 @@ class PullFileRequestTest { } output.respondDone() output.respondDone() + + output.close() + input.discard() } val request = PullFileRequest("/sdcard/testfile", tempFile)