Skip to content

Commit

Permalink
fix(test): drain connection in more pullfilerequest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Jan 30, 2021
1 parent cde9c11 commit 9e46cd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -129,6 +125,9 @@ class PullFileRequestTest {
}
output.respondDone()
output.respondDone()

output.close()
input.discard()
}

val request = PullFileRequest("/sdcard/testfile", tempFile)
Expand Down

0 comments on commit 9e46cd2

Please sign in to comment.