[FaultInjection] ThinClient Compatibility: Adds compatibility with Thin Client Proxy. #5264
Conversation
…//github.com/Azure/azure-cosmos-dotnet-v3 into users/nalutripician/FaultInjectionThinClient
There was a problem hiding this comment.
Pull Request Overview
This PR adds compatibility for Thin Client Proxy in the FaultInjection framework, ensuring that rules targeting gateway requests work correctly with the Thin Client. Key changes include updating method calls to pass the ThinClient request object, adding header assignments in the HTTP client for fault injection, and extending test coverage for the new Thin Client scenarios.
- Updated ThinClientStoreClient to pass the additional request parameter.
- Modified CosmosHttpClientCore to assign a fault injection header in two separate blocks.
- Extended tests and updated condition handling (including host-based comparisons) in the FaultInjection logic.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Microsoft.Azure.Cosmos/src/ThinClientStoreClient.cs | Updated InvokeClientAsync to pass the additional request parameter for ThinClient compatibility. |
| Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs | Added header assignment for fault injection in gateway requests; note the duplicated logic in two code blocks. |
| Microsoft.Azure.Cosmos/FaultInjection/tests/Utils/TestCommon.cs | Introduced a helper method for obtaining ThinClient connection strings. |
| Microsoft.Azure.Cosmos/FaultInjection/tests/FaultInjectionProxyTests.cs | Added extensive new test cases for fault injection rules with ThinClient. |
| Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs | Updated effective rule construction to pass the global endpoint manager. |
| Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs | Updated the constructor to require a GlobalEndpointManager and changed URI comparisons to use Host instead of AbsoluteUri. |
Comments suppressed due to low confidence (1)
Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionConditionInternal.cs:209
- [nitpick] Please consider adding a comment explaining the decision to use the Host property for comparison instead of the full AbsoluteUri to clarify the intent for future maintainers.
.StartsWith(uri.Host));
|
FI is a public library and this change ideal to go into the release notes |
Also not all kinds of faulults are not applicable for ThinProxy. At-least worth calling out which ones are applicable vs not. |
I will remove the internal tag and update the Fault Injection changelog for the next release. I will also add info in the readme about the Thin Proxy mode to this PR |
## FaultInjection 1.0.0-beta.1 release This PR releases the Microsoft.Azure.Cosmos.FaultInjection package at version **1.0.0-beta.1**. The previous release was 1.0.0-beta.0 on 2024-11-15. ### Version - `FaultInjectionVersion` = 1.0.0 - `FaultInjectionSuffixVersion` = beta.1 (was beta.0) ### Scope - Only the FaultInjection package is being released. No version bumps for Microsoft.Azure.Cosmos, Microsoft.Azure.Cosmos.Encryption, or Microsoft.Azure.Cosmos.Encryption.Custom. ### Included PRs (since 1.0.0-beta.0) #### Added - #4867 FaultInjection: Adds method to add FaultInjection using CosmosClientBuilder - #4989 Metadata Requests: Adds Metadata request support for FaultInjection - #5264 ThinClient Compatibility: Adds compatibility with Thin Client Proxy - #5510 Unauthorized Errors: Adds Unauthorized status codes - #5677 FaultInjection: Adds XML documentation, stylecop.json, and updates test packages - #5679 FaultInjection: Adds comprehensive unit test coverage #### Fixed - #5676 FaultInjection: Fixes naming typos and XML documentation - #5675 FaultInjection: Fixes critical bugs for release 2 - #5678 FaultInjection: Refactors code quality improvements ### Checklist - [x] Changelog updated (`Microsoft.Azure.Cosmos/FaultInjection/changelog.md`) - [x] Version bumped in `Directory.Build.props` - [ ] Release pipeline (`azure-pipelines-faultinjection.yml`) run after merge Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pull Request Template
Description
This PR allows FaultInjection rules that target gateway requests to also work with the ThinClient Proxy.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #5256