Skip to content

[Cosmos] Add compute error fault injection for address refresh - #50395

Open
Abhijeet Mohanty (jeet1995) wants to merge 1 commit into
Azure:mainfrom
jeet1995:users/abhmohanty/fault-injection-address-metadata-error-codes
Open

Abhijeet Mohanty (jeet1995) wants to merge 1 commit into
Azure:mainfrom
jeet1995:users/abhmohanty/fault-injection-address-metadata-error-codes

Conversation

@jeet1995

@jeet1995 Abhijeet Mohanty (jeet1995) commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Add COMPUTE_SERVICE_UNAVAILABLE (503/0) and COMPUTE_INTERNAL_SERVER_ERROR (500/102) fault-injection errors, including METADATA_REQUEST_ADDRESS_REFRESH support.
  • Preserve existing server-error mappings and restrictions on other metadata operations.
  • Extend the metadata builder matrix, exact status/substatus unit coverage, and PPCB address-refresh failover/recovery/failback coverage.

@github-actions github-actions Bot added the Cosmos label Sep 9, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
33 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jeet1995

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
33 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new unit test constructs RxDocumentServiceRequest using a non-existent create(...) overload, which will fail compilation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends the Cosmos fault-injection test infrastructure to model additional “compute” server failures during address refresh, and broadens both unit and E2E coverage to validate the new error mappings and PPCB failover/recovery behavior.

Changes:

  • Added new fault-injection server error types COMPUTE_SERVICE_UNAVAILABLE (503/0) and COMPUTE_INTERNAL_SERVER_ERROR (500/102), including metadata address-refresh allowance.
  • Updated fault-injection server error construction to emit the expected status/substatus/header mapping for the new compute errors.
  • Expanded unit/E2E tests to cover the new error types and verify they are surfaced in diagnostics and PPCB behavior.
File summaries
File Description
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/PerPartitionCircuitBreakerE2ETests.java Parameterizes the PPCB address-refresh recovery test to run against response delay and the new compute error types; asserts diagnostics capture the injected failure.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionUnitTest.java Extends metadata-operation validation and adds a data-driven unit test to verify status/substatus/header mappings.
sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/implementation/faultinjection/FaultInjectionServerErrorResultInternal.java Implements injected exception/header mapping for the new compute error types.
sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/faultinjection/FaultInjectionServerErrorType.java Adds new enum values for compute-originated server errors.
sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/faultinjection/FaultInjectionRuleBuilder.java Allows compute error types specifically for METADATA_REQUEST_ADDRESS_REFRESH metadata fault-injection rules.
sdk/cosmos/azure-cosmos-test/CHANGELOG.md Documents the added compute fault-injection error types and address-refresh support.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +137 to +138
RxDocumentServiceRequest request = RxDocumentServiceRequest.create(
null, OperationType.Read, "dbs/db/colls/coll", ResourceType.Address, Collections.emptyMap());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants