Skip to content

Conversation

@kushagraThapar
Copy link
Member

@kushagraThapar kushagraThapar commented Dec 26, 2025

This pull request updates the Cosmos DB Java SDK emulator test infrastructure to standardize and expand test coverage across different connection modes and test configurations. The main changes involve switching test data providers to new, more comprehensive variants and updating pipeline matrix templates to support both Direct and Gateway connection modes. Additionally, test group annotations are aligned to better reflect the intended test environments.

Test Data Provider Standardization and Expansion:

  • Updated most test classes to use new emulatorClientBuilders or related data providers, replacing older, more specific ones (e.g., clientBuildersWithDirect, clientBuildersWithDirectTcpSession, etc.), ensuring tests run with a broader and more consistent set of emulator configurations. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Test Group and Annotation Adjustments:

  • Changed test group annotations from "fast" to "emulator" in CosmosItemContentResponseOnWriteTest and added "emulator" to EmulatorVNextWithHttpTest to clarify test intent and environment, and ensure correct test execution grouping. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Pipeline Matrix Enhancements:

  • Added support for both Direct and Gateway connection modes in the Cosmos emulator integration test matrix templates, broadening test coverage across connection types.
  • Corrected the ProfileFlag in the vNext emulator matrix to use -Pemulator for consistency.

Test Suite Base Improvements:

  • Introduced a new connectionModes field in TestSuiteBase, defaulting to Gateway if unspecified, and updated initialization logic to parse connection modes from configuration, improving flexibility and backward compatibility. [1] [2] [3]

These changes collectively ensure more robust, flexible, and consistent emulator-based test coverage for the Cosmos DB Java SDK.Introduces new emulatorClientBuilders data providers to replace various test-specific data providers

Copilot AI review requested due to automatic review settings December 26, 2025 19:18
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 emulator tests to include vnext emulator support by introducing configurable connection modes (Direct/Gateway) and enabling previously ignored vector and full-text index tests. The changes consolidate test execution across emulator variants through new data provider patterns.

Key changes:

  • Adds CONNECTION_MODES configuration to support parameterized testing with Direct and Gateway connection modes
  • Enables Vector and FullText index tests by removing @Ignore annotations
  • Introduces new emulatorClientBuilders data providers to replace various test-specific data providers

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/TestConfigurations.java Adds CONNECTION_MODES configuration property for test parameterization
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java Removes @ignore annotation, adds Factory with emulatorClientBuilders, and uses injected client builder
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java Adds connectionModes field, parseConnectionModes method, and new emulatorClientBuilders data providers; removes simpleClientBuildersWithoutRetryOnThrottledRequests
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/FullTextIndexTest.java Removes @ignore annotation, adds Factory with emulatorClientBuilders, and uses injected client builder
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/FullFidelityChangeFeedTest.java Updates data provider from simpleClientBuildersWithDirectTcp to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/DocumentCrudTest.java Updates data provider from clientBuildersWithDirect to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/DocumentClientResourceLeakTest.java Updates data provider from simpleClientBuildersWithDirect to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/CollectionCrudTest.java Updates data provider from clientBuildersWithDirect to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/sdk/ThroughputControlGroupConfigConfigurationTests.java Updates data provider from clientBuildersWithSessionConsistency to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java Adds connectionModes field, parseConnectionModes method, and emulatorClientBuilders data providers; removes unused ITestContext import
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/MetadataThrottlingRetryPolicyTest.java Updates data provider from simpleClientBuildersWithoutRetryOnThrottledRequests to emulatorClientBuildersWithoutRetryOnThrottledRequests
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/MalformedResponseTests.java Updates data provider from clientBuildersWithSessionConsistency to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EmulatorVNextWithHttpTest.java Updates data provider and adds "emulator" group to BeforeClass, AfterClass, and Test annotations
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/DistributedClientTest.java Updates data provider from clientBuildersWithDirect to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemWriteRetriesTest.java Updates data provider from clientBuildersWithDirectTcpSession to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosItemContentResponseOnWriteTest.java Updates data provider and changes test group from "fast" to "emulator"
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsE2ETest.java Updates data provider from clientBuildersWithDirectSession to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDatabaseContentResponseOnWriteTest.java Updates data provider from clientBuildersWithDirectTcpWithContentResponseOnWriteDisabled to emulatorClientBuildersContentResponseOnWriteEnabledFalse
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosContainerContentResponseOnWriteTest.java Updates data provider from clientBuildersWithDirectTcpWithContentResponseOnWriteDisabled to emulatorClientBuildersContentResponseOnWriteEnabledFalse
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosContainerChangeFeedTest.java Updates data provider from simpleClientBuildersWithDirect to emulatorClientBuilders
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ChangeFeedContinuationTokenUtilsTests.java Updates data provider from simpleClientBuildersWithDirect to emulatorClientBuilders
eng/pipelines/templates/stages/cosmos-emulator-vnext-matrix.json Changes ProfileFlag from "-Pemulator-vnext" to "-Pemulator" to run vnext tests with standard emulator profile
eng/pipelines/templates/stages/cosmos-emulator-matrix.json Adds CONNECTION_MODES configuration to enable both Direct and Gateway mode testing
Comments suppressed due to low confidence (1)

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java:1320

  • The data provider simpleClientBuildersWithoutRetryOnThrottledRequests is being removed from rx/TestSuiteBase.java, but it is still being used by ThroughputControlTests.java in the implementation/throughputControl package. This will cause test compilation or runtime failures. The test should be updated to use emulatorClientBuildersWithoutRetryOnThrottledRequests instead.
    @DataProvider
    public static Object[][] simpleGatewayClient() {
        return new Object[][] {
            { createGatewayRxDocumentClient(ConsistencyLevel.SESSION, false, null, true, true) }
        };
    }

    private static Object[][] simpleClientBuildersWithDirect(

import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Factory;
import org.testng.annotations.Ignore;
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The import for org.testng.annotations.Ignore is no longer needed since the @ignore annotation has been removed from the class. This unused import should be removed to keep the code clean.

Suggested change
import org.testng.annotations.Ignore;

Copilot uses AI. Check for mistakes.
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Factory;
import org.testng.annotations.Ignore;
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The import for org.testng.annotations.Ignore is no longer needed since the @ignore annotation has been removed from the class. This unused import should be removed to keep the code clean.

Suggested change
import org.testng.annotations.Ignore;

Copilot uses AI. Check for mistakes.
@kushagraThapar
Copy link
Member Author

/azp run java - cosmos

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

1 participant