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

Update test cases for consistency, backfill missing cancel tests #874

Merged
merged 7 commits into from
May 23, 2024

Conversation

jhump
Copy link
Member

@jhump jhump commented May 23, 2024

After noticing some naming inconsistencies, I added a test that verifies that the embedded test files all conform to the naming conventions described in the docs.

That found a few issues, so this PR fixes them all.

I noticed and changed a few other things while doing this other clean-up in the tests:

  1. We were being lenient with gRPC implementations regarding an unknown content-type. That's because I thought this behavior (using a 415 HTTP status code) wasn't fully specified. But it turns out that it is! So I've moved these all to a test suite that is not protocol-specific, since all three protocols now expect the same behavior.
  2. I noticed a test that was commented out with a TODO. The change the TODO was contingent was on was already done, so the test could be re-enabled.
  3. The new naming convention test revealed a naming issue in the cancellation tests. When I went to fix that, I also noticed there were some redundant cases in here: the cancel-after-zero-responses test cases are not actually different than the cancel-after-close-send. While the contents of the test case are slightly different, the behavior they induce in the client is the same, which is to cancel the RPC right after the request stream is closed. It seemed odd that we'd have a test for cancelling "after" receiving zero responses. That's really like a cancel before the first response is received, and that felt awkward to implement since ideally you simply check that number after receiving a response (per the name of the field). So I opted to remove those and keep the cancel-after-close-send version.
  4. The server-stream cancel tests only had the cancel-after-zero-responses, and no cancel-after-close-send version. So I "fixed" that -- to use cancel-after-send for consistency with the others -- only to realize that the reference clients did not actually implement it. That's when I also realized that there was no test for cancelling unary RPCs. (The reference clients also did not implement cancellation in the unary RPC flow.)

The biggest changes in here were to get all of the client implementations to handle the cancel.after_close_send_ms field in the input.

jhump added 3 commits May 23, 2024 12:53
…x up issues; some other minor improvements

Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
…known-failing in grpcwebclient

Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
@jhump jhump requested a review from smaye81 May 23, 2024 16:55
Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
internal/app/grpcclient/impl.go Show resolved Hide resolved
testing/grpcwebclient/browserscript.ts Outdated Show resolved Hide resolved
…enceclient and grpcclient with the pseudo-code in docs

Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
@jhump jhump enabled auto-merge (squash) May 23, 2024 18:51
@jhump jhump merged commit 7d90745 into main May 23, 2024
7 checks passed
@jhump jhump deleted the jh/tweaking-test-cases branch May 23, 2024 19:04
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.

None yet

2 participants