Skip to content

fixFewTests - Part3#47939

Open
xinlian12 wants to merge 26 commits intoAzure:mainfrom
xinlian12:fixFewTests-part3
Open

fixFewTests - Part3#47939
xinlian12 wants to merge 26 commits intoAzure:mainfrom
xinlian12:fixFewTests-part3

Conversation

@xinlian12
Copy link
Member

No description provided.

Annie Liang added 12 commits February 6, 2026 10:57
- 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
@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@github-actions github-actions bot added the Cosmos label Feb 8, 2026
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xinlian12 xinlian12 marked this pull request as ready for review February 8, 2026 05:27
@xinlian12 xinlian12 requested review from a team and kirankumarkolli as code owners February 8, 2026 05:27
Copilot AI review requested due to automatic review settings February 8, 2026 05:27
@xinlian12 xinlian12 requested a review from a team as a code owner February 8, 2026 05:27
@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 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(...) with cleanUpContainer(...) and insertAllItemsBlocking(..., 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 cosmosItemResponse to something like bulkResponse/bulkOperationResponse would 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 cosmosItemResponse to something like bulkResponse/bulkOperationResponse would avoid confusion.

@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).

@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Annie Liang and others added 7 commits February 9, 2026 10:27
…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>
@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).

@xinlian12
Copy link
Member Author

/azp run java - cosmos - tests

@xinlian12 xinlian12 changed the title [NO Review]fixFewTests - Part3 fixFewTests - Part3 Feb 9, 2026
@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

logger.debug("Received name cache staled exception for collection [{}] with statusCode {}, subStatusCode {}, going to retry",
collectionLink,
clientException.getStatusCode(),
clientException.getSubStatusCode());
Copy link
Member

Choose a reason for hiding this comment

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

wondering if status code and substatus code are enough to find out which stale exception is hit?

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