Skip to content

Conversation

@xinlian12
Copy link
Member

@xinlian12 xinlian12 commented Feb 6, 2026

1. Test cleanup refactoring — bulk operations replace sequential deletes

The biggest change is in both TestSuiteBase classes (under rx/ and implementation/). The truncateCollection / cleanUpContainer methods are refactored to use Cosmos bulk operations (executeBulkOperations with CosmosBulkOperations.getDeleteItemOperation) instead of individual flatMap→deleteItem calls.

2. Bulk insert refactoring

The bulkInsert method is reworked to use the Cosmos bulk execution API (CosmosBulkOperations). A new insertAllItemsBlocking method is introduced, accepting a bulkEnabled parameter to choose between bulk and sequential insert.

3. Bulk insert concurrency reduced

DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL dropped from 500 → 5, likely to reduce throttling in test environments.

4. Test call-site updates (20+ test files)

All test files that called truncateCollection or bulkInsertBlocking are updated to use the renamed methods (cleanUpContainer, insertAllItemsBlocking).

Copilot AI review requested due to automatic review settings February 6, 2026 20:41
@xinlian12 xinlian12 requested review from a team and kirankumarkolli as code owners February 6, 2026 20:41
@github-actions github-actions bot added the Cosmos label Feb 6, 2026
@xinlian12 xinlian12 changed the title Fix few tests part2 [NO REVIEW]FixFewTests-part2 Feb 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Cosmos DB test infrastructure to use bulk execution APIs for container cleanup/truncation and adjusts several change feed tests to use the updated bulk insert helper.

Changes:

  • Switched test container cleanup/truncation from per-item deletes to executeBulkOperations.
  • Refactored bulkInsert in rx/TestSuiteBase to use bulk operations and updated change feed tests to match the new signature.
  • Minor test and code cleanup (helper rename, redundant exception catch removal, whitespace-only diff).

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java Whitespace-only diff in client initialization block.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java Updated calls to bulkInsert to match new helper signature.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java Updated calls to bulkInsert to match new helper signature.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java Updated calls to bulkInsert to match new helper signature.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java Reworked cleanup/truncation and bulk insert helpers to use bulk execution APIs.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java Renamed a local helper method to avoid confusion with updated bulkInsert.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java Updated legacy (DocumentClient-based) truncation to delete documents via bulk execution.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java Removed redundant JsonMappingException catch (covered by JsonProcessingException).

Annie Liang added 3 commits February 6, 2026 13:09
- 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.
@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

- 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
@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xinlian12 xinlian12 changed the title [NO REVIEW]FixFewTests-part2 FixFewTests-part2 Feb 8, 2026
@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @xinlian12

@xinlian12
Copy link
Member Author

/check-enforcer override

@xinlian12 xinlian12 merged commit 97bed4f into Azure:main Feb 9, 2026
95 of 97 checks passed
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