Skip to content

test: prove Polly resilience handler retries Google's HTTP 429#305

Merged
maximn merged 1 commit into
masterfrom
maximn/polly-resilience-handler
Jun 15, 2026
Merged

test: prove Polly resilience handler retries Google's HTTP 429#305
maximn merged 1 commit into
masterfrom
maximn/polly-resilience-handler

Conversation

@maximn

@maximn maximn commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

AddGoogleMaps already returns an IHttpClientBuilder, so .AddStandardResilienceHandler() from Microsoft.Extensions.Http.Resilience composes onto the Google Maps client without the core library taking any dependency on Polly. This PR proves that path with a regression test and documents it.

Related issue

n/a

Changes

  • Add GoogleMapsApi.Extensions.DependencyInjection.Test/ResilienceTests.cs: a hermetic test proving the standard handler retries a 429 then succeeds (429 → retry → 200), plus a smoke test that it chains off every AddGoogleMaps overload.
  • Reference Microsoft.Extensions.Http.Resilience 10.7.0 in the test project only (no new dependency on the core or DI library).
  • Expand README.md and .agents/dependency-injection.md with the install step, chaining example, and a tuning note (429/408/5xx retried by default, Retry-After honored, DisableForUnsafeHttpMethods() for writes).

Test plan

  • dotnet test on the DI test project: 9/9 pass on net8.0 and net10.0 (7 existing + 2 new); the 429 test asserts the fake handler was invoked twice, proving the retry fired.

Checklist

  • dotnet format has been run.
  • dotnet test passes locally (DI test project; no GOOGLE_API_KEY needed — tests are hermetic).
  • Multi-framework build passes (netstandard2.0, net8.0, net10.0).
  • XML documentation updated if public API surface changed. (No public API change.)

AddGoogleMaps already returns an IHttpClientBuilder, so
.AddStandardResilienceHandler() from Microsoft.Extensions.Http.Resilience
composes without any core-library dependency on Polly. Add a hermetic
regression test proving the standard handler retries a 429 then succeeds,
plus a smoke test that it chains off every AddGoogleMaps overload.

Expand the README and .agents/dependency-injection.md with the install
step, chaining example, and a tuning note (429/408/5xx are retried by
default, Retry-After honored, DisableForUnsafeHttpMethods for writes).
@github-actions

Copy link
Copy Markdown

🔬 TestGlance

✅ 251 passed across 1 job — 95.8% · ⏱️ 12.1s

Job Result Pass rate Duration Health
build 251/262 · 95.8% 12.1s Report
🟡 build — details

✅ 251 passed · ⏭️ 11 skipped
███████████████░ 95.8%
⏱️ 12.1s

vs master

Metric master PR Delta
Pass rate 95.8% 95.8% +0.0%
Duration 10.7s 12.1s +13.0%

📄 HTML Report


Updated 2026-06-15T19:36:57.980Z

@maximn maximn merged commit 04e4f7d into master Jun 15, 2026
6 checks passed
@maximn maximn deleted the maximn/polly-resilience-handler branch June 15, 2026 19:53
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.

1 participant