diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs index 403cd30bc9..0600c7be85 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs @@ -924,6 +924,18 @@ public void PooledConnectionLifetimeTest() Type clientMessageHandlerType = cosmosClient.ClientContext.DocumentClient.httpClient.HttpMessageHandler.GetType(); Assert.AreEqual(socketHandlerType, clientMessageHandlerType); } + + [TestMethod] + [TestCategory("MultiRegion")] + public async Task MultiRegionAccountTest() + { + string connectionString = TestCommon.GetMultiRegionConnectionString(); + Assert.IsFalse(string.IsNullOrEmpty(connectionString), "Connection String Not Set"); + using CosmosClient cosmosClient = new CosmosClient(connectionString); + Assert.IsNotNull(cosmosClient); + AccountProperties properties = await cosmosClient.ReadAccountAsync(); + Assert.IsNotNull(properties); + } public static IReadOnlyList GetActiveConnections() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs index 48a5025289..050e6ed4a7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs @@ -73,6 +73,11 @@ internal static (string endpoint, string authKey) GetAccountInfo() return (endpoint, authKey); } + internal static string GetMultiRegionConnectionString() + { + return Cosmos.ConfigurationManager.GetEnvironmentVariable("COSMOSDB_MULTI_REGION", string.Empty); + } + internal static CosmosClientBuilder GetDefaultConfiguration( bool useCustomSeralizer = true, bool validatePartitionKeyRangeCalls = false, diff --git a/azure-pipelines.yml b/azure-pipelines.yml index aae5115a5e..6d5c599c89 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,6 +50,7 @@ jobs: BuildConfiguration: Release Arguments: $(ReleaseArguments) VmImage: $(VmImage) + MultiRegionConnectionString: $(COSMOSDB_MULTI_REGION) - template: templates/build-internal.yml parameters: diff --git a/templates/build-test.yml b/templates/build-test.yml index 42c67d664c..a3cfedd231 100644 --- a/templates/build-test.yml +++ b/templates/build-test.yml @@ -5,12 +5,13 @@ parameters: Arguments: '' VmImage: '' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops OS: 'Windows' - EmulatorPipeline1Arguments: ' --filter "TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=LongRunning & (TestCategory=ClientTelemetryEmulator|TestCategory=Query|TestCategory=ReadFeed|TestCategory=Batch|TestCategory=ChangeFeed)" --verbosity normal ' - EmulatorPipeline2Arguments: ' --filter "TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=ClientTelemetryEmulator & TestCategory!=Query & TestCategory!=ReadFeed & TestCategory!=Batch & TestCategory!=ChangeFeed & TestCategory!=LongRunning" --verbosity normal ' + EmulatorPipeline1Arguments: ' --filter "TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=LongRunning & TestCategory!=MultiRegion & (TestCategory=ClientTelemetryEmulator|TestCategory=Query|TestCategory=ReadFeed|TestCategory=Batch|TestCategory=ChangeFeed)" --verbosity normal ' + EmulatorPipeline2Arguments: ' --filter "TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=ClientTelemetryRelease & TestCategory!=ClientTelemetryEmulator & TestCategory!=Query & TestCategory!=ReadFeed & TestCategory!=Batch & TestCategory!=ChangeFeed & TestCategory!=LongRunning & TestCategory!=MultiRegion" --verbosity normal ' EmulatorPipeline3Arguments: ' --filter "TestCategory=MultiRegion" --verbosity normal ' EmulatorPipeline1CategoryListName: ' Client Telemetry, Query, ChangeFeed, ReadFeed, Batch ' # Divided in 2 categories to run them in parallel and reduce the PR feedback time EmulatorPipeline2CategoryListName: ' Others ' EmulatorPipeline3CategoryListName: ' MultiRegion ' + MultiRegionConnectionString : '' jobs: - job: @@ -236,3 +237,5 @@ jobs: nugetConfigPath: NuGet.config publishTestResults: true testRunTitle: Microsoft.Azure.Cosmos.EmulatorTests + env: + COSMOSDB_MULTI_REGION: ${{ parameters.MultiRegionConnectionString }}