Skip to content
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

Improve how the test-suite deals with exceptions #91

Merged
merged 10 commits into from
Feb 17, 2024

Conversation

edsko
Copy link
Collaborator

@edsko edsko commented Feb 17, 2024

This also makes a few improvements to the make library itself:

  • More consistent exceptions between the server and the client API: both now report a CallSetupFailure exception if the call cannot be established (though they use different definitions).
  • Clients can specify initial compression algorithm, independent from the server (connInitCompression)
  • The server will always support identity compression (unless using insist); see Negotation for details.
  • If the server responds with an HTTP status other than 200, the response body will be included in the exception for easier debugging (@domenkozar, perhaps this is what you were asking about in Deal with broken deployments #22 (comment) ?)
  • The server can insist on a compression algorithm, independent of what the client says (insist)
  • Server handlers can now raise a GrpcException in the client by calling sendGrpcException instead by throwing this exception themselves; see sendGrpcException for discussion for the trade-off.

edsko added 10 commits February 16, 2024 12:39
See documentation of `sendGrpcException` for details.
While the output is nicer than `Show`, the package is very incomplete, and it
was making maintaining/updating the test suite more cumbersome than it should
be.
This is the first step towards making exception handling in the test suite more
surgical: rather than collecting exceptions at the top-level, we verify _at the
source_ whether or not they are expected, and if so, don't allow them to bubble
up at all. This means that we can then stop the test suite at the first
(unexpected) exception. This will make the tests easier to understand and
setup: for example, as things stand, when one client fails, the other clients
are killed, but that will then result in further exceptions in those clients.

This doesn't get us all the way there yet, but it makes some progress towards
this goal.
This is now done locally. The only thing left now is the compression negotation
failures.
The client API now has a `CallSetupFailure` just like the server API does.

We no longer allow the client to _insist_ on compression; see documentation of
`Network.GRPC.Common.Compression.Negotation.choose`.
In the process, this makes a few other improvements:

* The client can now insist on an initial compression algorithm,
  before compression negotation has taken place (`connInitCompression`)
* The server can insist on a particular compression algorithm,
  independent of what the client offers (`insist`)
* When the server returns a HTTP status other than 200, we include the
  response body in the exception (this might help with #22, specifically
  #22 (comment))
The TLS failures are now handled the same way as the rest.

This now means that once we see an exception bubble up from either a client or
a handler, that exception really is a test failure, and we should stop the
test.
This paves the way for the next step.
@edsko
Copy link
Collaborator Author

edsko commented Feb 17, 2024

Verified that this still passes all interop tests (grapesy server, reference client in Java, C++, Go, and Python).

@edsko edsko merged commit a7b8da5 into main Feb 17, 2024
8 checks passed
@edsko edsko deleted the edsko/testsuite-exceptions branch February 17, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant