[Internal/FaultInjection] ServerErrorResults: Adds custom server error results for internal testing and repors #5581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
This pull request introduces a new mechanism for injecting custom server errors with arbitrary status and substatus codes into the Cosmos DB Fault Injection framework. It adds builder and result classes for defining and applying custom server error rules, and updates the main interceptor logic to support these rules for both direct (StoreResponse) and gateway (HttpResponseMessage) modes.
The most important changes are:
Custom Server Error Injection Support:
FaultInjectionCustomServerErrorResultclass to represent custom server errors with configurable status code, substatus code, delay, suppression, and injection rate. This is intended for internal testing only.FaultInjectionCustomServerErrorResultBuilderto simplify the creation and configuration of custom server error results, including validation and fluent API for setting options.FaultInjectionCustomServerErrorResultInternalto handle the internal logic for applying custom server errors, including generating the appropriate response objects for both direct and gateway modes.Interceptor Logic Updates:
ChaosInterceptorto check for and apply custom server error rules before standard server error rules for both direct and gateway request paths. This ensures that custom error rules take precedence when present. [1] [2]Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber