mirror of
https://github.com/square/okhttp.git
synced 2025-07-31 05:04:26 +03:00
Fix android test (#8157)
This commit is contained in:
@ -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"""))
|
||||
@ -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"""))
|
||||
@ -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"""))
|
||||
@ -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}"""))
|
||||
@ -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}"""))
|
||||
@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user