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

V1: Fix lint errors and wire up to CI #605

Merged
merged 5 commits into from
Oct 25, 2023
Merged

V1: Fix lint errors and wire up to CI #605

merged 5 commits into from
Oct 25, 2023

Conversation

smaye81
Copy link
Member

@smaye81 smaye81 commented Oct 25, 2023

This performs some minor cleanup to the repo. Namely:

  • Fixes any lint errors occurring when running make lint
  • Adds an Unimplemented endpoint to ConformanceService so that unimplemented RPCs can be tested
  • Cleans up the CI workflow, removing all the old Docker steps in favor of a slimmed down workflow that simply runs test, lint, and checkgenerate. Note, there are no tests right now, but some could be added in the future.
  • Renames a few proto fields for consistency and/or clarity
  • Updates buf.gen.yaml to use the remote plugin for protoc-gen-go rather than rely on a locally installed plugin. Note this also updates to use latest version (1.31.0)

@smaye81 smaye81 requested a review from jhump October 25, 2023 02:24
@smaye81
Copy link
Member Author

smaye81 commented Oct 25, 2023

@jhump if you'd rather I split these up into smaller PRs, that's cool too. Just figured since this was mostly inconsequential chore work, I'd combine them into one.

@jhump jhump changed the title Fix lint errors and wire up to CI V2: Fix lint errors and wire up to CI Oct 25, 2023
Comment on lines +91 to +93
// A unary endpoint that the server should not implement and should instead
// return an unimplemented error when invoked.
rpc Unimplemented(UnimplementedRequest) returns (UnimplementedResponse);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is sufficient. It is perhaps useful, but it only captures the case where the server handler does provide the method: it's in the proto and thus in the generated server interfaces. So the only reason it will be unimplemented is because the server framework is supplying a default implementation.

We will also eventually need to test completely unimplemented services and methods -- service and method names not known to the server at all. This can't be done right now using a simple switch in the reference client, so we can punt on it.

In the client implementation (not this PR), we probably want a TODO in the switch default that we'll eventually want to support other dispatch mechanisms -- that will allow us to do all kinds of things, like simulate exotic or intentionally incorrect client behavior, to verify how the server reacts.

Note that only the reference will need to be able to craft requests for such unknown services and methods, since that is testing the server behavior. Other clients-under-test would not need to worry about it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Should I just remove this here? I feel like it's useful to test the scenario you mention: server knows about a service, but has not yet implemented it. But, I can certainly delete it if you don't think it provides that much value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to leave it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old protos defined a unary and a server-streaming RPC that should not be implemented, and a separate service that should not be implemented, also with unary and server-streaming RPCs. It never seemed like a good solution to me.

I tend to think that it might be sufficient to:

  1. have the reference client call unknown RPCs to verify they respond with either HTTP 404 or a gRPC / Connect unimplemented error
  2. have the reference server respond with HTTP 404 and gRPC / Connect unimplemented error responses for certain test cases (based on test name in a request header)

This doesn't verify that servers reply with an in-protocol unimplemented error, but IMO this behavior could be considered an application-level or framework-level feature, not strictly a requirement by the protocol. On the upside, it doesn't introduce RPCs for the testee to reason about.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that was basically along the lines I was thinking for how to expand on this. Only the reference clients/servers need to handle these edge cases (i.e. a client-under-test will never need to be able to send a request for an unimplemented service or method).

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
// This field is only relevant in the first message in the stream
// and should be ignored in subsequent messages.
// Note, this is only applicable to bidi endpoints.
bool full_duplex = 16;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. I thought this change had already been made.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was in server_compat.proto. Changing it here to match.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right 👍

@smaye81 smaye81 merged commit dcb9a22 into v2 Oct 25, 2023
5 checks passed
@smaye81 smaye81 deleted the sayers/lint_etc branch October 25, 2023 14:07
@jhump jhump changed the title V2: Fix lint errors and wire up to CI V: Fix lint errors and wire up to CI Nov 20, 2023
@jhump jhump changed the title V: Fix lint errors and wire up to CI V1: Fix lint errors and wire up to CI Nov 20, 2023
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.

3 participants