grpc-streaming-test-author
БесплатноБез исполняемых скриптовНе проверенUse when a server-streaming, client-streaming or bidirectional gRPC call needs tests, or a suite needs auditing for gaps: ordering, completion, cancellation…
от testland★ 18 звёзд на GitHubОб этом скилле
grpc-streaming-test-author
Overview
Streaming RPCs are where gRPC clients and servers most often diverge from the proto contract - message ordering, completion signalling, cancellation, and partial-failure semantics are all testable surfaces. gRPC defines four streaming patterns - unary, server-streaming, client-streaming, bidirectional - per grpc.io/docs/what-is-grpc/core-concepts/; Step 1 classifies each RPC by pattern.
This skill walks through producing a comprehensive test suite
from the proto file. It composes
grpc-mock for the test harness and
references/status-codes.md
for status-code assertions; live-server (non-bufconn) patterns are in
references/wire-level-testing.md.
When to use
- Adding tests for a new streaming RPC.
- Auditing an existing streaming-RPC test suite - is each pattern's required category covered?
- Investigating a streaming-RPC bug - minimal repro from the test matrix.
- PR review of changes to streaming RPCs (the proto-evolution
rules on
streamchanges are subtle - perbuf-cli-lint-breaking-buildreferences/versioning-strategy.md).
Step 1 - Classify each RPC
Walk the .proto file and tabulate:
service Chat {
rpc Send(Message) returns (Ack); // unary
rpc Subscribe(SubReq) returns (stream Event); // server streaming
rpc Upload(stream Chunk) returns (UploadResult); // client streaming
rpc Conversation(stream Message) returns (stream Reply); // bidi
}
| RPC | Pattern | Required test categories |
|---|---|---|
Send |
unary | success, every status code per references/status-codes.md |
Subscribe |
server-stream | success, ordering, server-side close after N messages, server-side mid-stream error, client-side cancel mid-stream, deadline-exceeded mid-stream |
Upload |
client-stream | success, server completes before client finishes, server-side error mid-upload, client-side cancel before send, empty stream |
Conversation |
bidi | success, ordering per direction, client closes send while still receiving, server closes send while still receiving, both close, deadline mid-conversation, error mid-conversation |
Step 2 - Test categories per pattern
Unary (covered for completeness)
def test_send_returns_ok(stub):
resp = stub.Send(Message(body="hi"))
assert resp.ok
def test_send_returns_invalid_argument(stub):
with pytest.raises(grpc.RpcError) as exc:
stub.Send(Message(body=""))
assert exc.value.code() == grpc.StatusCode.INVALID_ARGUMENT
Server-streaming
Ordering preservation - per gRPC docs: "gRPC guarantees message ordering within an individual RPC call."
def test_subscribe_preserves_ordering(stub_with_fake):
stub_with_fake.fake_response_stream = [
Event(seq=1), Event(seq=2), Event(seq=3),
]
received = list(stub_with_fake.Subscribe(SubReq()))
assert [e.seq for e in received] == [1, 2, 3]
Server closes after N messages - completion is the finalisation signal:
def test_subscribe_completes_after_finite_stream(stub_with_fake):
stub_with_fake.fake_response_stream = [Event(seq=1), Event(seq=2)]
events = list(stub_with_fake.Subscribe(SubReq()))
# If list(...) terminates, the server-side close was signalled.
assert len(events) == 2
Server-side error mid-stream:
def test_subscribe_propagates_error_mid_stream(stub_with_fake):
stub_with_fake.fake_response_stream = [Event(seq=1)]
stub_with_fake.fake_post_yield_status = grpc.StatusCode.INTERNAL
events_iter = stub_with_fake.Subscribe(SubReq())
# Receive first event OK
next(events_iter)
# Subsequent receive fails with INTERNAL per references/status-codes.md
with pytest.raises(grpc.RpcError) as exc:
next(events_iter)
assert exc.value.code() == grpc.StatusCode.INTERNAL
Client cancel mid-stream:
def test_client_cancel_mid_stream(stub_with_fake):
stub_with_fake.fake_response_stream = [Event(seq=i) for i in range(100)]
events_iter = stub_with_fake.Subscribe(SubReq())
next(events_iter) # receive one
events_iter.cancel()
with pytest.raises(grpc.RpcError) as exc:
next(events_iter)
assert exc.value.code() == grpc.StatusCode.CANCELLED
Deadline-exceeded mid-stream:
def test_subscribe_deadline_exceeded(stub_with_slow_fake):
events_iter = stub_with_slow_fake.Subscribe(SubReq(), timeout=0.1)
with pytest.raises(grpc.RpcError) as exc:
for _ in events_iter:
pass
assert exc.value.code() == grpc.StatusCode.DEADLINE_EXCEEDED
Client-streaming
Categories: success, server completes before client finishes (further
Send yields io.EOF), server-side error mid-upload, client-side
cancel before send, empty stream. Go bufconn s
Установить grpc-streaming-test-author в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл grpc-streaming-test-author?
Use when a server-streaming, client-streaming or bidirectional gRPC call needs tests, or a suite needs auditing for gaps: ordering, completion, cancellation, deadlines and partial failures, with skeletons for Go, Python, JVM and Node, plus the 17 gRPC status codes and their retry rules.
Как установить скилл grpc-streaming-test-author?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл grpc-streaming-test-author запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic