Skip to content

feat: add Dapr.IntegrationTest.DaprClient integration tests for HTTP and gRPC proxy invocation#1814

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/analysis-check-test-coverage
Draft

feat: add Dapr.IntegrationTest.DaprClient integration tests for HTTP and gRPC proxy invocation#1814
Copilot wants to merge 3 commits intomasterfrom
copilot/analysis-check-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Summary

Creates Dapr.IntegrationTest.DaprClient — a new integration test project that covers the legacy Dapr.Client service-invocation surface area against a real Dapr sidecar. This closes the gap identified in the previous analysis where HTTP service invocation and gRPC proxy tests existed only in the older Dapr.E2E.Test suite (which runs against a locally-installed dapr CLI) and not yet in the modern container-based Dapr.IntegrationTest.* suite.

Changes

src/Dapr.Testcontainers — library extensions

File Change
Common/Options/DaprRuntimeOptions.cs Added AppProtocol property (default "http") and validated WithAppProtocol() fluent setter
Containers/Dapr/DaprdContainer.cs Forwards options.AppProtocol as -app-protocol on the daprd command line
Harnesses/BaseHarness.cs Exposed public string AppId so tests can discover the auto-generated app-id for routing
Harnesses/ServiceInvocationHarness.cs (new) Zero-infrastructure harness (no Redis / RabbitMQ) for HTTP and gRPC proxy tests
Common/DaprHarnessBuilder.cs Added BuildServiceInvocation() factory method

test/Dapr.IntegrationTest.DaprClient — new test project

Auto-discovered by CI via the Dapr.IntegrationTest.*.csproj glob. Builds on net8.0 / net9.0 / net10.0.

File Purpose
Dapr.IntegrationTest.DaprClient.csproj SDK.Web project, references Dapr.Client + Dapr.Testcontainers + Grpc.AspNetCore + Grpc.Tools
Protos/echo.proto Simple EchoService (unary, bidirectional streaming, slow-echo)
GrpcServices/EchoServiceImpl.cs In-process gRPC service implementation
ServiceInvocation/HttpServiceInvocationTests.cs Covers CreateInvokeHttpClient, CreateInvokableHttpClient, and three InvokeMethodAsync overloads
ServiceInvocation/GrpcProxyInvocationTests.cs Covers unary gRPC proxy call, bidirectional streaming, and deadline-exceeded behaviour

Test coverage added

HTTP service invocation (HttpServiceInvocationTests)

  • CreateInvokeHttpClient — POST with typed payload; GET request
  • CreateInvokableHttpClient (instance method) — relative URI routed through sidecar
  • InvokeMethodAsync<TRequest, TResponse> — typed request + typed response
  • InvokeMethodAsync<TResponse> — no request body, typed response
  • InvokeMethodAsync<TRequest> — typed request, void (204) response

gRPC proxy invocation (GrpcProxyInvocationTests)

  • Unary call succeeds end-to-end through the Dapr sidecar
  • Bidirectional streaming echoes all sent messages back in order
  • Past-deadline call raises RpcException with StatusCode.DeadlineExceeded

How it works

Each test spins up its own ServiceInvocationHarness via DaprHarnessBuilder. For HTTP tests the harness uses the default --app-protocol http; for gRPC proxy tests WithOptions(new DaprRuntimeOptions().WithAppProtocol("grpc")) is passed so daprd uses gRPC to talk to the in-process Kestrel server (configured for HTTP/2 cleartext). No external infrastructure (Redis, RabbitMQ, etc.) is needed.

Notes

  • The [Obsolete] attribute on test methods is the standard pattern in this repo for suppressing CS0618 when testing deprecated APIs (matches DaprClientTest.InvokeMethodAsync.cs etc.)
  • The legacy Dapr.E2E.Test service-invocation tests are left untouched for now; they can be retired once this suite is stable in CI

Copilot AI and others added 2 commits May 9, 2026 08:45
…and gRPC proxy invocation

Agent-Logs-Url: https://github.com/dapr/dotnet-sdk/sessions/d477244b-9f9b-439e-9c0a-791e2add786e

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.34%. Comparing base (85f94fa) to head (3584c25).

Files with missing lines Patch % Lines
...estcontainers/Common/Options/DaprRuntimeOptions.cs 12.50% 7 Missing ⚠️
...stcontainers/Harnesses/ServiceInvocationHarness.cs 0.00% 4 Missing ⚠️
...c/Dapr.Testcontainers/Common/DaprHarnessBuilder.cs 0.00% 1 Missing ⚠️
src/Dapr.Testcontainers/Harnesses/BaseHarness.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1814      +/-   ##
==========================================
- Coverage   65.42%   65.34%   -0.08%     
==========================================
  Files         296      297       +1     
  Lines        8694     8709      +15     
  Branches     1009     1010       +1     
==========================================
+ Hits         5688     5691       +3     
- Misses       2761     2774      +13     
+ Partials      245      244       -1     
Flag Coverage Δ
net10.0 65.33% <13.33%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants