Conversation
- Add isSuccessStatusCode() validation for non-2xx bulk responses in all 3 sites (impl/TestSuiteBase truncateCollection, rx/TestSuiteBase cleanUpContainerInternal, rx/TestSuiteBase bulkInsert) - Keep 409/Conflict handling in bulkInsert but validate other non-2xx responses - Return server-created items from bulkInsertBlocking via getItem(clazz) - Use PartitionKey.NONE instead of new PartitionKey(null) in cleanUpContainerInternal
…agation Use BridgeInternal.createCosmosException() with status code and substatus code from CosmosBulkItemResponse instead of generic IllegalStateException.
- Add insertUsingPointOperations for one-by-one createItem path - Add bulkEnabled parameter to insertAllItemsBlocking/voidInsertAllItemsBlocking - Rename bulkInsertBlocking -> insertAllItemsBlocking - Rename voidBulkInsertBlocking -> voidInsertAllItemsBlocking - Update all callers with explicit bulkEnabled=true
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR focuses on stabilizing Cosmos SDK test execution by standardizing test container cleanup and item insertion patterns, and by adding extra diagnostics in a few flaky scenarios.
Changes:
- Replaced many test usages of
truncateCollection(...)/bulkInsertBlocking(...)withcleanUpContainer(...)andinsertAllItemsBlocking(..., bulkEnabled)in Rx test suites. - Refactored Rx test base cleanup/insertion helpers to use partition-key aware bulk operations in more places.
- Added additional test diagnostics/logging (and one timing workaround) to help investigate intermittent failures.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java | Minor whitespace-only diff in client initialization block. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java | Updated change feed tests to use new bulk insert helper signature. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java | Updated change feed tests to use new bulk insert helper signature. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java | Updated change feed tests to use new bulk insert helper signature. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/ChangeFeedProcessorMigrationTests.java | Switched setup insert helper for migration tests. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VeryLargeDocumentQueryTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/UserDefinedFunctionUpsertReplaceTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/UserDefinedFunctionQueryTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TriggerUpsertReplaceTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TriggerQueryTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TopQueryTests.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java | Reworked cleanup and insert helpers; introduced bulk-operation-based insert/delete utilities. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/StoredProcedureQueryTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionReadFeedDocumentsTest.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionDocumentQueryTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedUdfsTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedTriggersTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedStoredProceduresTest.java | Switched setup cleanup helper to cleanUpContainer. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedDocumentsTest.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/QueryValidationTests.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ParallelDocumentQueryTest.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java | Renamed helper and switched cleanup/insertion to new helpers. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OffsetLimitQueryTests.java | Switched setup cleanup helper and bulk insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/MultiOrderByQueryTests.java | Switched setup cleanup helper and bulk insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/GroupByQueryTests.java | Switched setup cleanup helper and bulk insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/FeedRangeQueryTests.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/DistinctQueryTests.java | Switched setup cleanup helper and bulk insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ContainerCreateDeleteWithSameNameTest.java | Switched setup insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ClientRetryPolicyE2ETests.java | Added additional diagnostics logging for slow test runs. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureTest.java | Switched setup insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java | Switched setup insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/AggregateQueryTests.java | Switched setup cleanup helper and bulk insert helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java | Refactored truncateCollection to use async SDK container + bulk deletes and script cleanup. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnDirectTests.java | Added a fixed delay before validating diagnostics for async address refresh. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EndToEndTimeOutValidationTests.java | Switched setup cleanup helper and item insertion helper. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosNotFoundTests.java | Added extra diagnostics logging when unexpected substatus is observed. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java | Simplified exception handling by removing redundant JsonMappingException catch. |
Comments suppressed due to low confidence (2)
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java:1011
- The value passed into this flatMap is no longer a CosmosItemResponse (bulkInsert now emits CosmosBulkOperationResponse). Renaming
cosmosItemResponseto something likebulkResponse/bulkOperationResponsewould avoid confusion.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java:994 - The value passed into this flatMap is no longer a CosmosItemResponse (bulkInsert now emits CosmosBulkOperationResponse). Renaming
cosmosItemResponseto something likebulkResponse/bulkOperationResponsewould avoid confusion.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java
Outdated
Show resolved
Hide resolved
...rc/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnDirectTests.java
Outdated
Show resolved
Hide resolved
...test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java
Outdated
Show resolved
Hide resolved
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…mplementation/TestSuiteBase.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…aultinjection/FaultInjectionServerErrorRuleOnDirectTests.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…mplementation/TestSuiteBase.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e-sdk-for-java into fixFewTests-part3
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
kushagraThapar
left a comment
There was a problem hiding this comment.
LGTM, thanks @xinlian12
| logger.debug("Received name cache staled exception for collection [{}] with statusCode {}, subStatusCode {}, going to retry", | ||
| collectionLink, | ||
| clientException.getStatusCode(), | ||
| clientException.getSubStatusCode()); |
There was a problem hiding this comment.
wondering if status code and substatus code are enough to find out which stale exception is hit?
No description provided.