Skip to content

Commit

Permalink
testfix
Browse files Browse the repository at this point in the history
  • Loading branch information
buildbreaker committed Aug 10, 2023
1 parent 112a5b7 commit d0e38fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crosstests/google-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ sourceSets {
}

dependencies {
implementation(libs.okhttp.core)

implementation(libs.kotlin.coroutines.core)
implementation(libs.assertj)
implementation(libs.protobuf.kotlin)
implementation(project(":crosstests:common"))
implementation(project(":extensions:google-java"))
implementation(project(":okhttp"))

testImplementation(libs.okhttp.core)
testImplementation(libs.junit)
testImplementation(libs.assertj)
testImplementation(libs.mockito)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
import java.time.Duration
import java.util.Base64
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -214,7 +215,7 @@ class CrossTest(
val headers =
mapOf(
leadingKey to listOf(leadingValue),
trailingKey to listOf(trailingValue.b64Encode())
trailingKey to listOf(b64Encode(trailingValue))
)
val message = simpleRequest {
responseSize = size
Expand All @@ -224,7 +225,7 @@ class CrossTest(
testServiceConnectClient.unaryCall(message, headers) { response ->
assertThat(response.code).isEqualTo(Code.OK)
assertThat(response.headers[leadingKey]).containsExactly(leadingValue)
assertThat(response.trailers[trailingKey]).containsExactly(trailingValue.b64Encode())
assertThat(response.trailers[trailingKey]).containsExactly(b64Encode(trailingValue))
response.failure {
fail<Unit>("expected error to be null")
}
Expand Down Expand Up @@ -424,7 +425,7 @@ class CrossTest(
val headers =
mapOf(
leadingKey to listOf(leadingValue),
trailingKey to listOf(trailingValue.b64Encode())
trailingKey to listOf(b64Encode(trailingValue))
)
val message = simpleRequest {
responseSize = size
Expand All @@ -434,7 +435,7 @@ class CrossTest(
testServiceConnectClient.unaryCall(message, headers) { response ->
assertThat(response.code).isEqualTo(Code.OK)
assertThat(response.headers[leadingKey]).containsExactly(leadingValue)
assertThat(response.trailers[trailingKey]).containsExactly(trailingValue.b64Encode())
assertThat(response.trailers[trailingKey]).containsExactly(b64Encode(trailingValue))
response.failure {
fail<Unit>("expected error to be null")
}
Expand Down Expand Up @@ -547,4 +548,8 @@ class CrossTest(
countDownLatch.await(500, TimeUnit.MILLISECONDS)
assertThat(countDownLatch.count).isZero()
}

private fun b64Encode(trailingValue: ByteArray): String {
return String(Base64.getEncoder().encode(trailingValue))
}
}

0 comments on commit d0e38fe

Please sign in to comment.