Skip to content

Commit

Permalink
Fix android test (#8157)
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke authored Dec 24, 2023
1 parent 265cb04 commit cea704d
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ class LoggingEventListenerTest {
assertThat(response.body).isNotNull()
response.body.bytes()
logRecorder
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}"""))
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}"""))
.assertLogMatch(Regex("""proxySelectStart: $url"""))
.assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]"""))
.assertLogMatch(Regex("""dnsStart: ${url.host}"""))
.assertLogMatch(Regex("""dnsEnd: \[.+]"""))
.assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT"""))
.assertLogMatch(Regex("""connectEnd: http/1.1"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1}"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1\}"""))
.assertLogMatch(Regex("""requestHeadersStart"""))
.assertLogMatch(Regex("""requestHeadersEnd"""))
.assertLogMatch(Regex("""responseHeadersStart"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url}"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url\}"""))
.assertLogMatch(Regex("""responseBodyStart"""))
.assertLogMatch(Regex("""responseBodyEnd: byteCount=6"""))
.assertLogMatch(Regex("""connectionReleased"""))
Expand All @@ -107,20 +107,20 @@ class LoggingEventListenerTest {
server.enqueue(MockResponse())
client.newCall(request().post("Hello!".toRequestBody(PLAIN)).build()).execute()
logRecorder
.assertLogMatch(Regex("""callStart: Request\{method=POST, url=$url}"""))
.assertLogMatch(Regex("""callStart: Request\{method=POST, url=$url\}"""))
.assertLogMatch(Regex("""proxySelectStart: $url"""))
.assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]"""))
.assertLogMatch(Regex("""dnsStart: ${url.host}"""))
.assertLogMatch(Regex("""dnsEnd: \[.+]"""))
.assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT"""))
.assertLogMatch(Regex("""connectEnd: http/1.1"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1}"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1\}"""))
.assertLogMatch(Regex("""requestHeadersStart"""))
.assertLogMatch(Regex("""requestHeadersEnd"""))
.assertLogMatch(Regex("""requestBodyStart"""))
.assertLogMatch(Regex("""requestBodyEnd: byteCount=6"""))
.assertLogMatch(Regex("""responseHeadersStart"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url}"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url\}"""))
.assertLogMatch(Regex("""responseBodyStart"""))
.assertLogMatch(Regex("""responseBodyEnd: byteCount=0"""))
.assertLogMatch(Regex("""connectionReleased"""))
Expand All @@ -139,20 +139,20 @@ class LoggingEventListenerTest {
response.body.bytes()
platform.assumeHttp2Support()
logRecorder
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}"""))
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}"""))
.assertLogMatch(Regex("""proxySelectStart: $url"""))
.assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]"""))
.assertLogMatch(Regex("""dnsStart: ${url.host}"""))
.assertLogMatch(Regex("""dnsEnd: \[.+]"""))
.assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT"""))
.assertLogMatch(Regex("""secureConnectStart"""))
.assertLogMatch(Regex("""secureConnectEnd: Handshake\{tlsVersion=TLS_1_[23] cipherSuite=TLS_.* peerCertificates=\[CN=localhost] localCertificates=\[]}"""))
.assertLogMatch(Regex("""secureConnectEnd: Handshake\{tlsVersion=TLS_1_[23] cipherSuite=TLS_.* peerCertificates=\[CN=localhost] localCertificates=\[]\}"""))
.assertLogMatch(Regex("""connectEnd: h2"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=.+ protocol=h2}"""))
.assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=.+ protocol=h2\}"""))
.assertLogMatch(Regex("""requestHeadersStart"""))
.assertLogMatch(Regex("""requestHeadersEnd"""))
.assertLogMatch(Regex("""responseHeadersStart"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=h2, code=200, message=, url=$url}"""))
.assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=h2, code=200, message=, url=$url\}"""))
.assertLogMatch(Regex("""responseBodyStart"""))
.assertLogMatch(Regex("""responseBodyEnd: byteCount=0"""))
.assertLogMatch(Regex("""connectionReleased"""))
Expand All @@ -172,7 +172,7 @@ class LoggingEventListenerTest {
} catch (expected: UnknownHostException) {
}
logRecorder
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}"""))
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}"""))
.assertLogMatch(Regex("""proxySelectStart: $url"""))
.assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]"""))
.assertLogMatch(Regex("""dnsStart: ${url.host}"""))
Expand All @@ -197,7 +197,7 @@ class LoggingEventListenerTest {
} catch (expected: IOException) {
}
logRecorder
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}"""))
.assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}"""))
.assertLogMatch(Regex("""proxySelectStart: $url"""))
.assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]"""))
.assertLogMatch(Regex("""dnsStart: ${url.host}"""))
Expand All @@ -222,10 +222,10 @@ class LoggingEventListenerTest {
listener.cacheMiss(call)
listener.satisfactionFailure(call, response)
logRecorder
.assertLogMatch(Regex("""cacheConditionalHit: Response\{protocol=h2, code=200, message=, url=$url}"""))
.assertLogMatch(Regex("""cacheHit: Response\{protocol=h2, code=200, message=, url=$url}"""))
.assertLogMatch(Regex("""cacheConditionalHit: Response\{protocol=h2, code=200, message=, url=$url\}"""))
.assertLogMatch(Regex("""cacheHit: Response\{protocol=h2, code=200, message=, url=$url\}"""))
.assertLogMatch(Regex("""cacheMiss"""))
.assertLogMatch(Regex("""satisfactionFailure: Response\{protocol=h2, code=200, message=, url=$url}"""))
.assertLogMatch(Regex("""satisfactionFailure: Response\{protocol=h2, code=200, message=, url=$url\}"""))
.assertNoMoreLogs()
}

Expand Down

0 comments on commit cea704d

Please sign in to comment.