-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance verbose output of conformance client and enable stream conformance tests #212
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
af4822f
add VerbosePrinter and verbose output up to verbosity level 5, includ…
jhump 54f5b5c
fixup conformance config files: opt out of client message size tests …
jhump e416c20
enable new conformance tests for streams
jhump d7a5f00
simplify -v option parsing; use original code (possibly 408 instead o…
jhump File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to print the exception stack trace too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn't is because it wasn't really useful. These errors propagate to the caller, which means these exceptions already get logged elsewhere at just verbosity 1 or 2.