[Internal] Pipelines: Fixes Multi-Region CI pipeline to include env variable (#4363)

* Fixes Multi-Region CI pipeline to include env variable

* fixed space

* added validation test

* string conversion

* temp

* temp2

* Update Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>

* Update Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>

* changed env location

* temp

* test

* space

* remove env

* possible fix

* test fix

* clean up

* changed enviroment variable get

* test

* test fix

* ensure multiregion tests do not run with regular emulator tests

---------

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
This commit is contained in:
Nalu Tripician 2024-03-25 14:19:04 -07:00 коммит произвёл GitHub
Родитель dbdf8064f5
Коммит 75a2e5f98a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -924,6 +924,18 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
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<string> GetActiveConnections()
{

Просмотреть файл

@ -73,6 +73,11 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
return (endpoint, authKey);
}
internal static string GetMultiRegionConnectionString()
{
return Cosmos.ConfigurationManager.GetEnvironmentVariable<string>("COSMOSDB_MULTI_REGION", string.Empty);
}
internal static CosmosClientBuilder GetDefaultConfiguration(
bool useCustomSeralizer = true,
bool validatePartitionKeyRangeCalls = false,

Просмотреть файл

@ -50,6 +50,7 @@ jobs:
BuildConfiguration: Release
Arguments: $(ReleaseArguments)
VmImage: $(VmImage)
MultiRegionConnectionString: $(COSMOSDB_MULTI_REGION)
- template: templates/build-internal.yml
parameters:

Просмотреть файл

@ -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 }}