-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance verbose output of conformance client and enable stream confor…
…mance tests (#212) The big change here is that the stream conformance test cases now run in CI (and thus actually work!). This also adds verbose output features to the conformance client. There are now 5 levels of verbosity. 1. Prints the start and end of each test case. If an error occurs, prints the exception's stack trace. 2. Prints exception stack traces for all RPC errors encountered and any errors that occur when calling `send`. (These could be expected errors, for tests of error conditions, which is why they are not enabled at verbosity 1). 3. Prints the full messages read from stdin and results written to stdout (in protobuf text format). Also adds a tracing decorator to the `HTTPClientInterface` implementation, to print out each step in an RPC. 4. Adds an okhttp event logger, to trace each step in the underlying HTTP framework. 5. Turns on stack-trace logging for the above okhttp event logger and `HTTPClientInterface` tracing, so that each step shows its full stack trace (useful since some operations can happen from different threads and control flow and source of events can be non-obvious).
- Loading branch information
Showing
19 changed files
with
409 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
# OkHttp seems to have a bug where timeout is not properly | ||
# enforced when request body is full-duplex. | ||
# We currently rely on OkHttp's "call timeout" to handle | ||
# RPC deadlines, but that is not enforced when the request | ||
# body is duplex. So timeouts don't currently work with | ||
# bidi streams. | ||
Timeouts/HTTPVersion:2/**/bidi half duplex timeout | ||
Timeouts/HTTPVersion:2/**/bidi full duplex timeout | ||
|
||
# Connect-kotlin does not have a way to limit the size of messages | ||
# received. It probably should. Despite this, many cases in this suite | ||
# still pass, so they are likely not exercising what we think they are. | ||
# TODO: add flag to config yaml for whether implementation supports | ||
# a receive size limit | ||
Client Message Size/**/Compression:COMPRESSION_GZIP/TLS:false/**/client stream first request exceeds client limit | ||
Client Message Size/**/Compression:COMPRESSION_GZIP/TLS:false/**/client stream subsequent request exceeds client limit | ||
Client Message Size/**/Compression:COMPRESSION_GZIP/TLS:false/**/client stream all requests equal to client limit | ||
Client Message Size/**/Compression:COMPRESSION_GZIP/TLS:false/**/server stream request equal to client limit | ||
Client Message Size/**/Compression:COMPRESSION_GZIP/TLS:false/**/server stream request exceeds client limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
conformance/client/src/main/kotlin/com/connectrpc/conformance/client/OkHttpEventTracer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2022-2023 The Connect Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.connectrpc.conformance.client | ||
|
||
import com.connectrpc.okhttp.originalCode | ||
import okhttp3.Call | ||
import okhttp3.Connection | ||
import okhttp3.EventListener | ||
import okhttp3.Protocol | ||
import okhttp3.Request | ||
import okhttp3.Response | ||
import java.io.IOException | ||
import java.net.InetSocketAddress | ||
import java.net.Proxy | ||
|
||
internal class OkHttpEventTracer( | ||
private val printer: VerbosePrinter.Printer, | ||
) : EventListener() { | ||
override fun connectStart(call: Call, inetSocketAddress: InetSocketAddress, proxy: Proxy) { | ||
printer.printlnWithStackTrace("connecting to $inetSocketAddress...") | ||
} | ||
override fun connectEnd( | ||
call: Call, | ||
inetSocketAddress: InetSocketAddress, | ||
proxy: Proxy, | ||
protocol: Protocol?, | ||
) { | ||
printer.printlnWithStackTrace("connected to $inetSocketAddress") | ||
} | ||
override fun connectFailed( | ||
call: Call, | ||
inetSocketAddress: InetSocketAddress, | ||
proxy: Proxy, | ||
protocol: Protocol?, | ||
ioe: IOException, | ||
) { | ||
printer.printlnWithStackTrace("connect to $inetSocketAddress failed") | ||
} | ||
override fun connectionAcquired(call: Call, connection: Connection) { | ||
printer.printlnWithStackTrace("connection to ${connection.socket().remoteSocketAddress} acquired") | ||
} | ||
override fun requestHeadersStart(call: Call) { | ||
printer.printlnWithStackTrace("writing request headers...") | ||
} | ||
override fun requestHeadersEnd(call: Call, request: Request) { | ||
printer.printlnWithStackTrace("request headers written") | ||
} | ||
override fun requestBodyStart(call: Call) { | ||
printer.printlnWithStackTrace("writing request body...") | ||
} | ||
override fun requestBodyEnd(call: Call, byteCount: Long) { | ||
printer.printlnWithStackTrace("request body written: $byteCount bytes") | ||
} | ||
override fun requestFailed(call: Call, ioe: IOException) { | ||
printer.printlnWithStackTrace("request failed: ${ioe.message}") | ||
} | ||
override fun responseHeadersStart(call: Call) { | ||
printer.printlnWithStackTrace("reading response headers...") | ||
} | ||
override fun responseHeadersEnd(call: Call, response: Response) { | ||
printer.printlnWithStackTrace("response headers read: status code = ${response.originalCode()}") | ||
} | ||
override fun responseBodyStart(call: Call) { | ||
printer.printlnWithStackTrace("reading response body...") | ||
} | ||
override fun responseBodyEnd(call: Call, byteCount: Long) { | ||
printer.printlnWithStackTrace("response body read: $byteCount bytes") | ||
} | ||
override fun responseFailed(call: Call, ioe: IOException) { | ||
printer.printlnWithStackTrace("response failed: ${ioe.message}") | ||
} | ||
} |
Oops, something went wrong.