cockroachdb / cockroachdb/cockroach

drpc: add unit tests for protoc-gen-go-drpc HTTP gateway route generator

Open
#170,333 1 comment 0 reactions 0 assignees View on GitHub
C-enhancement T-db-server
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

## Background

cockroachdb/drpc#56 added the `protoc-gen-go-drpc` generator feature that reads `google.api.http` annotations from proto method options and emits `DRPCGatewayRoutes` functions in the generated `*_drpc.pb.go` files. Each function returns a `[]drpc.HTTPRoute` containing the HTTP method, path, and a reference to the corresponding RPC client method.

The PR shipped without unit tests for the generator itself.

## Task

Add unit tests for the `protoc-gen-go-drpc` generator covering the HTTP gateway route generation logic, including:

- Correct emission of `DRPCGatewayRoutes` for methods with `google.api.http` annotations
- Skipping of streaming RPCs
- Skipping of methods without HTTP annotations
- Edge cases (multiple HTTP bindings, nested path params, etc.)

## Notes

This should be relatively low-effort — a good candidate for Claude Code to scaffold the test suite. The generator logic lives in the `cockroachdb/drpc` repo but the tracking issue is here since that's where we manage DRPC-related work.

## References

- PR: https://github.com/cockroachdb/drpc/pull/56

Jira issue: CRDB-63937

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.