diff --git a/.agents/skills/cosmos-provider/SKILL.md b/.agents/skills/cosmos-provider/SKILL.md index 92a540fd512..fb3634430ef 100644 --- a/.agents/skills/cosmos-provider/SKILL.md +++ b/.agents/skills/cosmos-provider/SKILL.md @@ -20,3 +20,13 @@ Non-relational provider with its own parallel query pipeline. Uses JSON for docu - Partition key configuration required for performance - `ETag` for optimistic concurrency - No cross-container joins + +## Azure Cosmos DB Emulator in Docker + +Cosmos tests on Helix start the emulator from the work item via `PreCommands` that run a Docker container using: +- `eng/testing/run-cosmos-container.ps1` +- `eng/testing/run-cosmos-container.sh` + +These scripts can be invoked locally for testing on machines that don't have the emulator installed, but have docker available. + +The `Test__Cosmos__SkipConnectionCheck=true` env var is set to prevent tests from being skipped when the emulator failed to start. diff --git a/.github/workflows/TestCosmos.yaml b/.github/workflows/TestCosmos.yaml index 7b5199fea05..ce9ec900f5f 100644 --- a/.github/workflows/TestCosmos.yaml +++ b/.github/workflows/TestCosmos.yaml @@ -34,6 +34,8 @@ jobs: - name: Test on Cosmos run: dotnet test test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj shell: cmd + env: + Test__Cosmos__SkipConnectionCheck: true - name: Publish Test Results uses: actions/upload-artifact@v7 diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index a9b06cfb5a0..184cbfad733 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -38,6 +38,22 @@ jobs: --health-retries=30 --health-timeout=5s + cosmosdb: + image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview + ports: + - 8081:8081 + env: + PROTOCOL: https + ENABLE_EXPLORER: "false" + options: >- + --health-cmd="curl -k https://localhost:8081/ || exit 1" + --health-start-period=120s + --health-interval=5s + --health-retries=60 + --health-timeout=5s + steps: - - name: Export connection string for the agent's session - run: echo 'Test__SqlServer__DefaultConnection=Server=localhost;Database=test;User=SA;Password=PLACEHOLDERPass$$w0rd;Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true' >> "$GITHUB_ENV" + - name: Export environment variables for the agent's session + run: | + echo 'Test__SqlServer__DefaultConnection=Server=localhost;Database=master;User=SA;Password=PLACEHOLDERPass$$w0rd;Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true' >> "$GITHUB_ENV" + echo 'Test__Cosmos__EmulatorType=linux' >> "$GITHUB_ENV" diff --git a/azure-pipelines-internal-tests.yml b/azure-pipelines-internal-tests.yml index fada0fb0478..16ba4895f67 100644 --- a/azure-pipelines-internal-tests.yml +++ b/azure-pipelines-internal-tests.yml @@ -211,7 +211,7 @@ extends: - name: _HelixBuildConfig value: $(_BuildConfig) - name: HelixTargetQueues - value: Windows.10.Amd64;OSX.15.Amd64;OSX.15.ARM64;Ubuntu.2204.Amd64.XL@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64 + value: Windows.10.Amd64;OSX.15.Amd64;OSX.15.ARM64;Ubuntu.2204.Amd64.XL@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64;Ubuntu.2204.Amd64.XL;Ubuntu.2204.Amd64 - name: _HelixAccessToken # Needed for internal queues value: $(HelixApiAccessToken) diff --git a/azure-pipelines-public.yml b/azure-pipelines-public.yml index 894f669bff4..0b6c766cff9 100644 --- a/azure-pipelines-public.yml +++ b/azure-pipelines-public.yml @@ -152,7 +152,7 @@ stages: - name: _HelixBuildConfig value: $(_BuildConfig) - name: HelixTargetQueues - value: Windows.10.Amd64.Open;OSX.15.Amd64.Open;Ubuntu.2204.Amd64.XL.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64 + value: Windows.10.Amd64.Open;OSX.15.Amd64.Open;OSX.15.ARM64.Open;Ubuntu.2204.Amd64.XL.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64;Ubuntu.2204.Amd64.XL.Open;Ubuntu.2204.Amd64.Open - name: _HelixAccessToken value: '' # Needed for public queues steps: diff --git a/eng/helix.proj b/eng/helix.proj index 7a19771eaf6..b8916309738 100644 --- a/eng/helix.proj +++ b/eng/helix.proj @@ -12,12 +12,13 @@ true true - $(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.SqlServer.HierarchyId.Tests/*.csproj;$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.AspNet.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.VisualBasic.FunctionalTests/*.vbproj;$(RepoRoot)/test/EFCore.FSharp.FunctionalTests/*.fsproj + $(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.SqlServer.HierarchyId.Tests/*.csproj;$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.AspNet.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.VisualBasic.FunctionalTests/*.vbproj;$(RepoRoot)/test/EFCore.FSharp.FunctionalTests/*.fsproj + $(RepoRoot)/test/EFCore.Cosmos.FunctionalTests/*.csproj - Windows.10.Amd64.Open;OSX.1200.Amd64.Open;OSX.1200.ARM64.Open;Ubuntu.2204.Amd64.XL.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64 + Windows.10.Amd64.Open;OSX.15.Amd64.Open;OSX.15.ARM64.Open;Ubuntu.2204.Amd64.XL.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-sqlserver-amd64;Ubuntu.2204.Amd64.XL.Open;Ubuntu.2204.Amd64.Open false efcore/localbuild/ t001 @@ -33,6 +34,10 @@ runtime + + + testing + @@ -53,25 +58,48 @@ - + - + $(PreCommands); SqlLocalDB start + + + + $(PreCommands); set Test__Cosmos__SkipConnectionCheck=true + + - - + + - + $(PreCommands); export MSSQL_SA_PASSWORD=$(MSSQL_SA_PASSWORD); export Test__SqlServer__DefaultConnection="Server=localhost;;Database=master;;User=sa;;Password=$(MSSQL_SA_PASSWORD);;Connect Timeout=60;;ConnectRetryCount=0;;TrustServerCertificate=True"; /opt/mssql/bin/sqlservr --accept-eula &; sleep 120; - - + + + + + + $(PreCommands); chmod +x $HELIX_CORRELATION_PAYLOAD/testing/run-cosmos-container.sh; $HELIX_CORRELATION_PAYLOAD/testing/run-cosmos-container.sh; export Test__Cosmos__DefaultConnection=https://localhost:8081; export Test__Cosmos__SkipConnectionCheck=true; export Test__Cosmos__EmulatorType=linux + $(PostCommands); docker stop cosmos-emulator || true; docker rm -f cosmos-emulator || true + + + + + + + + + + + + diff --git a/eng/testing/run-cosmos-container.ps1 b/eng/testing/run-cosmos-container.ps1 new file mode 100644 index 00000000000..e5cde422b52 --- /dev/null +++ b/eng/testing/run-cosmos-container.ps1 @@ -0,0 +1,61 @@ +# Starts the Azure Cosmos DB Emulator in a Windows Docker container and waits for it to be ready. +# Tests run on the host machine connecting to the emulator via https://localhost:8081. +# Usage: .\run-cosmos-container.ps1 +param() + +$ErrorActionPreference = 'Stop' +$image = 'mcr.microsoft.com/cosmosdb/windows/azure-cosmos-emulator' +$containerName = 'cosmos-emulator' +$port = 8081 +$maxRetries = 90 +$retryDelaySec = 2 + +Write-Host "Pulling image: $image" +docker pull $image +if ($LASTEXITCODE -ne 0) { throw "docker pull failed with exit code $LASTEXITCODE" } + +Write-Host "Checking for existing container named $containerName..." +$existingContainerId = docker ps -a --filter "name=^${containerName}$" --format '{{.ID}}' +if ($LASTEXITCODE -ne 0) { throw "docker ps failed with exit code $LASTEXITCODE" } +if ($existingContainerId) { + Write-Host "Existing container '$containerName' found. Stopping and removing it..." + docker stop $containerName 2>$null + docker rm -f $containerName + if ($LASTEXITCODE -ne 0) { throw "docker rm failed with exit code $LASTEXITCODE" } +} + +# -t is required because Start.ps1 sets [Console]::BufferWidth which needs a TTY handle. +Write-Host "Starting Cosmos DB Emulator container on port $port..." +docker run -d -t ` + --name $containerName ` + --publish "${port}:8081" ` + --memory 2G ` + $image +if ($LASTEXITCODE -ne 0) { throw "docker run failed with exit code $LASTEXITCODE" } + +Write-Host "Waiting for emulator to be ready (up to $($maxRetries * $retryDelaySec)s)..." +$ready = $false +for ($i = 0; $i -lt $maxRetries; $i++) { + Start-Sleep -Seconds $retryDelaySec + # Any HTTP response (even 401) means the emulator is up and accepting connections. + $null = & curl.exe -k "https://localhost:${port}/" --silent --output NUL --max-time 5 + if ($LASTEXITCODE -eq 0) { + $ready = $true + } else { + Write-Host " Attempt $($i+1)/$maxRetries - not ready yet..." + } + if ($ready) { + Write-Host "Cosmos DB Emulator is ready on port $port." + break + } +} + +if (-not $ready) { + Write-Host "Emulator did not become ready. Container logs:" + docker logs $containerName + docker stop $containerName 2>$null + docker rm -f $containerName 2>$null + exit 1 +} + +exit 0 diff --git a/eng/testing/run-cosmos-container.sh b/eng/testing/run-cosmos-container.sh new file mode 100644 index 00000000000..8005f6b12b5 --- /dev/null +++ b/eng/testing/run-cosmos-container.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Starts the Azure Cosmos DB Linux (vNext) Emulator in a Docker container and waits for it to be ready. +# Tests run on the host machine connecting to the emulator via https://localhost:8081. +# The --protocol https flag is required because the .NET SDK does not support HTTP mode. +# Usage: ./run-cosmos-container.sh + +set -e + +image='mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview' +container_name='cosmos-emulator' +port=8081 +max_retries=30 +retry_delay=2 + +echo "Pulling image: $image" +docker pull "$image" + +if docker ps -a --format '{{.Names}}' | grep -Eq "^${container_name}\$"; then + echo "Removing existing Cosmos DB Emulator container: $container_name" + docker rm -f "$container_name" +fi + +echo "Starting Cosmos DB Emulator container on port $port with HTTPS..." +docker run -d \ + --name "$container_name" \ + --publish "${port}:8081" \ + "$image" \ + --protocol https \ + --enable-explorer false + +echo "Waiting for emulator to be ready (up to ~$((max_retries * retry_delay))s)..." +ready=false +for i in $(seq 1 "$max_retries"); do + sleep "$retry_delay" + if curl -ks --connect-timeout "$retry_delay" --max-time "$retry_delay" "https://localhost:${port}/" -o /dev/null; then + ready=true + echo "Cosmos DB Emulator is ready." + break + fi + echo " Attempt $i/$max_retries - not ready yet..." +done + +if [ "$ready" != true ]; then + echo "Emulator did not become ready. Container logs:" + docker logs "$container_name" + docker stop "$container_name" 2>/dev/null || true + docker rm -f "$container_name" 2>/dev/null || true + exit 1 +fi + +exit 0 diff --git a/src/EFCore/Query/Internal/QueryCompiler.cs b/src/EFCore/Query/Internal/QueryCompiler.cs index c4df4b66531..7d59e478670 100644 --- a/src/EFCore/Query/Internal/QueryCompiler.cs +++ b/src/EFCore/Query/Internal/QueryCompiler.cs @@ -156,8 +156,7 @@ public virtual Expression ExtractParameters( Expression query, Dictionary parameters, IDiagnosticsLogger logger, - bool compiledQuery = false, - bool generateContextAccessors = false) + bool compiledQuery = false) => new ExpressionTreeFuncletizer(_model, _evaluatableExpressionFilter, _contextType, generateContextAccessors: false, logger) .ExtractParameters(query, parameters, parameterize: !compiledQuery, clearParameterizedValues: true); } diff --git a/test/EFCore.Cosmos.FunctionalTests/AddHocFullTextSearchCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/AddHocFullTextSearchCosmosTest.cs index 1d7dc6742a0..f9e3f93b647 100644 --- a/test/EFCore.Cosmos.FunctionalTests/AddHocFullTextSearchCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/AddHocFullTextSearchCosmosTest.cs @@ -141,6 +141,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #region SettingDefaultFullTextSearchLanguage [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Set_unsupported_full_text_search_default_language() { var exception = (await Assert.ThrowsAsync(() => InitializeNonSharedTest())); @@ -224,6 +225,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #region DefaultFullTextSearchLanguageNoMismatchWhenNotSpecified [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Explicitly_setting_default_full_text_language_doesnt_clash_with_not_setting_it_on_other_entity_for_the_same_container() { @@ -298,6 +300,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #region DefaultFullTextSearchLanguageUsedWhenPropertyDoesntSpecifyOneExplicitly [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Default_full_text_language_is_used_for_full_text_properties_if_they_dont_specify_language_themselves() { var exception = (await Assert.ThrowsAsync(() @@ -337,6 +340,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #region ExplicitFullTextLanguageOverridesTheDefault [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Explicitly_setting_full_text_language_overrides_default() { var exception = diff --git a/test/EFCore.Cosmos.FunctionalTests/ConfigPatternsCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/ConfigPatternsCosmosTest.cs index 25252236e4c..dffdabadae9 100644 --- a/test/EFCore.Cosmos.FunctionalTests/ConfigPatternsCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/ConfigPatternsCosmosTest.cs @@ -89,6 +89,7 @@ public async Task Should_throw_if_specified_region_is_wrong() } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] [PlatformSkipCondition( TestUtilities.Xunit.TestPlatform.Mac, SkipReason = "Test is very environment-dependent; when running the Cosmos emulator in a VM on Mac, ConnectionMode.Direct causes severe issues")] diff --git a/test/EFCore.Cosmos.FunctionalTests/CosmosSessionTokensTest.cs b/test/EFCore.Cosmos.FunctionalTests/CosmosSessionTokensTest.cs index 7bcddc9d42e..1765ae99729 100644 --- a/test/EFCore.Cosmos.FunctionalTests/CosmosSessionTokensTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/CosmosSessionTokensTest.cs @@ -9,6 +9,7 @@ namespace Microsoft.EntityFrameworkCore; +[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public class CosmosSessionTokensTest(CosmosSessionTokensTest.CosmosFixture fixture) : IClassFixture { private const string DatabaseName = nameof(CosmosSessionTokensTest); @@ -601,6 +602,7 @@ protected Test2Context() } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public class CosmosNonSharedSessionTokenTests(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture { protected override ITestStoreFactory NonSharedTestStoreFactory diff --git a/test/EFCore.Cosmos.FunctionalTests/CosmosTransactionalBatchTest.cs b/test/EFCore.Cosmos.FunctionalTests/CosmosTransactionalBatchTest.cs index 1831aff89ef..08fc076cb21 100644 --- a/test/EFCore.Cosmos.FunctionalTests/CosmosTransactionalBatchTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/CosmosTransactionalBatchTest.cs @@ -8,6 +8,7 @@ namespace Microsoft.EntityFrameworkCore; +[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public class CosmosTransactionalBatchTest(CosmosTransactionalBatchTest.CosmosFixture fixture) : IClassFixture, IAsyncLifetime { private const string DatabaseName = nameof(CosmosTransactionalBatchTest); diff --git a/test/EFCore.Cosmos.FunctionalTests/CosmosTriggersTest.cs b/test/EFCore.Cosmos.FunctionalTests/CosmosTriggersTest.cs index 546c151a723..60d346ef459 100644 --- a/test/EFCore.Cosmos.FunctionalTests/CosmosTriggersTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/CosmosTriggersTest.cs @@ -16,6 +16,7 @@ protected override ITestStoreFactory NonSharedTestStoreFactory => CosmosTestStoreFactory.Instance; [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Triggers_are_executed_on_SaveChanges() { var contextFactory = await InitializeNonSharedTest(shouldLogCategory: _ => true); diff --git a/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs b/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs index 153fdb7343f..23adc286440 100644 --- a/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs @@ -100,6 +100,7 @@ public virtual async Task Can_attach_owner_with_dependents() } [ConditionalTheory, InlineData(false), InlineData(true)] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task Can_manipulate_embedded_collections(bool useIds) { var options = await Fixture.CreateOptions(seed: false); diff --git a/test/EFCore.Cosmos.FunctionalTests/EndToEndCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/EndToEndCosmosTest.cs index 0f81ad16f9a..1b35b3c9e4e 100644 --- a/test/EFCore.Cosmos.FunctionalTests/EndToEndCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/EndToEndCosmosTest.cs @@ -15,6 +15,7 @@ namespace Microsoft.EntityFrameworkCore; public class EndToEndCosmosTest(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture { [ConditionalTheory, InlineData(false), InlineData(true)] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public async Task Can_add_update_delete_end_to_end(bool transactionalBatch) { var contextFactory = await InitializeNonSharedTest( diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesCollectionCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesCollectionCosmosTest.cs index e92b46d76d0..a944b75fc73 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesCollectionCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesCollectionCosmosTest.cs @@ -26,6 +26,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Where() { await base.Where(); @@ -87,6 +88,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ElementAt() { // 'ORDER BY' is not supported in subqueries. @@ -158,6 +160,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Index_column() { // The specified query includes 'member indexer' which is currently not supported @@ -205,6 +208,7 @@ public override Task GroupBy() #endregion GroupBy + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_within_Select_within_Select_with_aggregates() { await base.Select_within_Select_within_Select_with_aggregates(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesPrimitiveCollectionCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesPrimitiveCollectionCosmosTest.cs index cf3fb5fba77..5ea60ba3e2f 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesPrimitiveCollectionCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesPrimitiveCollectionCosmosTest.cs @@ -72,6 +72,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_Sum() { await base.Select_Sum(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionCosmosTest.cs index 294657d03a3..545d57fbe78 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionCosmosTest.cs @@ -39,6 +39,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Where() { await base.Where(); @@ -54,6 +55,7 @@ FROM a IN c["AssociateCollection"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ElementAt() { // 'ORDER BY' is not supported in subqueries. @@ -114,6 +116,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Index_column() { // The specified query includes 'member indexer' which is currently not supported @@ -161,6 +164,7 @@ public override Task GroupBy() #endregion GroupBy + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_within_Select_within_Select_with_aggregates() { await base.Select_within_Select_within_Select_with_aggregates(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionCosmosTest.cs index bc5958c8896..f73a0c0014e 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionCosmosTest.cs @@ -72,6 +72,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_Sum() { await base.Select_Sum(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs index 7b4b1da164e..6e23673b9cc 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs @@ -567,6 +567,7 @@ public override async Task Json_collection_index_in_predicate_nested_mix(bool as Assert.Equal(NotImplementedBindPropertyMessage, message); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Json_collection_index_in_predicate_using_column(bool async) { // Always throws for sync. @@ -576,6 +577,7 @@ public override async Task Json_collection_index_in_predicate_using_column(bool } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Json_collection_index_in_predicate_using_complex_expression1(bool async) { // Always throws for sync. diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs index db4d129b9b4..0a018ded306 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs @@ -676,6 +676,7 @@ OFFSET 0 LIMIT 1 } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task MaxBy_no_data_nullable_source(bool async) { // Always throws for sync. @@ -760,6 +761,7 @@ OFFSET 0 LIMIT 1 """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task MaxBy_with_coalesce(bool async) { // Always throws for sync. @@ -844,6 +846,7 @@ OFFSET 0 LIMIT 1 } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task MinBy_no_data_nullable_source(bool async) { // Always throws for sync. @@ -912,6 +915,7 @@ public override async Task MinBy_no_data_subquery_value_type(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task MinBy_with_coalesce(bool async) { // Always throws for sync. @@ -1418,6 +1422,7 @@ public override async Task Count_after_client_projection(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_client_Take(bool async) { // Always throws for sync. @@ -2267,6 +2272,7 @@ WHERE NOT(false) """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Contains_top_level(bool async) { // Always throws for sync. @@ -2519,6 +2525,7 @@ WHERE ARRAY_CONTAINS(@ids, c["id"]) """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Contains_over_entityType_with_null_should_rewrite_to_false(bool async) { // Always throws for sync. @@ -2622,6 +2629,7 @@ WHERE ARRAY_CONTAINS(@ids, c["id"]) """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override Task Where_subquery_where_any(bool async) => Fixture.NoSyncTest( async, async a => @@ -2692,6 +2700,7 @@ WHERE NOT(ARRAY_CONTAINS(@ids, c["id"])) """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override Task Where_subquery_where_all(bool async) => Fixture.NoSyncTest( async, async a => diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs index f98ee1fc818..e23671a9b35 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs @@ -36,6 +36,7 @@ FROM root c """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Order_by_length_twice(bool async) { // Always throws for sync. diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs index 1b33b8007bc..dc5a98c0b74 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs @@ -469,6 +469,7 @@ public override async Task Let_any_subquery_anonymous(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_arithmetic(bool async) { // Always throws for sync. @@ -486,6 +487,7 @@ ORDER BY (c["EmployeeID"] - c["EmployeeID"]) } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_condition_comparison(bool async) { // Always throws for sync. @@ -504,6 +506,7 @@ ORDER BY (c["UnitsInStock"] > 0), c["ProductID"] } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ternary_conditions(bool async) { // Always throws for sync. @@ -801,6 +804,7 @@ await AssertTranslationFailedWithDetails( AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Any_simple(bool async) { // Always throws for sync. @@ -820,6 +824,7 @@ SELECT 1 } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Any_predicate(bool async) { // Always throws for sync. @@ -1293,6 +1298,7 @@ public override Task Skip_Take_Distinct(bool async) () => base.Skip_Take_Distinct(async), CosmosStrings.LimitOffsetNotSupportedInSubqueries); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Skip_Take_Any(bool async) { // Always throws for sync. @@ -1356,6 +1362,7 @@ ORDER BY c["id"] """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_true(bool async) { // Always throws for sync. @@ -1373,6 +1380,7 @@ ORDER BY true } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_integer(bool async) { // Always throws for sync. @@ -1389,6 +1397,7 @@ ORDER BY 3 } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_parameter(bool async) { // Always throws for sync. @@ -1468,6 +1477,7 @@ public override async Task Distinct_Take_Count(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_shadow(bool async) { // Always throws for sync. @@ -1484,6 +1494,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_multiple(bool async) { // Always throws for sync. @@ -1502,6 +1513,7 @@ WHERE STARTSWITH(c["id"], "A") } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ThenBy_Any(bool async) { // Always throws for sync. @@ -1719,6 +1731,7 @@ public override async Task Select_many_cross_join_same_collection(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_null_coalesce_operator(bool async) { // Always throws for sync. @@ -1736,6 +1749,7 @@ ORDER BY ((c["Region"] != null) ? c["Region"] : "ZZ"), c["id"] } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_null_coalesce_operator(bool async) { // Always throws for sync. @@ -1757,6 +1771,7 @@ ORDER BY ((c["Region"] != null) ? c["Region"] : "ZZ"), c["id"] } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_conditional_operator(bool async) { // Always throws for sync. @@ -1787,6 +1802,7 @@ ORDER BY c["City"] """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_comparison_operator(bool async) { // Always throws for sync. @@ -1843,6 +1859,7 @@ await AssertTranslationFailedWithDetails( AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_take_null_coalesce_operator(bool async) { // Always throws for sync. @@ -1895,6 +1912,7 @@ await AssertTranslationFailedWithDetails( AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Selected_column_can_coalesce(bool async) { // Always throws for sync. @@ -2307,6 +2325,7 @@ public override async Task DefaultIfEmpty_in_subquery_nested_filter_order_compar ); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_skip_take(bool async) { // Always throws for sync. @@ -2530,6 +2549,7 @@ public override async Task Anonymous_complex_distinct_result(bool async) ); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Anonymous_complex_orderby(bool async) { // Always throws for sync. @@ -2616,6 +2636,7 @@ public override async Task DTO_complex_distinct_result(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task DTO_complex_orderby(bool async) { // Always throws for sync. @@ -3062,6 +3083,7 @@ public override async Task Join_take_count_works(bool async) ); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_empty_list_contains(bool async) { // Always throws for sync. @@ -3079,6 +3101,7 @@ ORDER BY ARRAY_CONTAINS(@list, c["id"]) } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_empty_list_does_not_contains(bool async) { // Always throws for sync. @@ -3202,6 +3225,7 @@ FROM root c """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Entity_equality_orderby_descending_composite_key(bool async) { // Always throws for sync. @@ -3287,6 +3311,7 @@ public override async Task Null_Coalesce_Short_Circuit(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderByDescending_ThenBy(bool async) { // Always throws for sync. @@ -3304,6 +3329,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderByDescending_ThenByDescending(bool async) { // Always throws for sync. @@ -3329,6 +3355,7 @@ public override async Task OrderBy_Join(bool async) ); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ThenBy(bool async) { // Always throws for sync. @@ -3346,6 +3373,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ThenBy_predicate(bool async) { // Always throws for sync. @@ -4826,6 +4854,7 @@ FROM root c #region ToPageAsync [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task ToPageAsync() { await using var context = CreateContext(); @@ -4881,6 +4910,7 @@ ORDER BY c["id"] } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task ToPageAsync_with_scalar() { await using var context = CreateContext(); @@ -5030,6 +5060,7 @@ public override async Task Column_access_inside_subquery_predicate(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Cast_to_object_over_parameter_directly_in_lambda(bool async) { // Sync always throws before getting to exception being tested. diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindSelectQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindSelectQueryCosmosTest.cs index 57cdc298604..94159423707 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindSelectQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindSelectQueryCosmosTest.cs @@ -192,6 +192,7 @@ public override async Task Select_bool_closure_with_order_by_property_with_cast_ AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Select_bool_closure_with_order_parameter_with_cast_to_nullable(bool async) { // Always throws for sync. @@ -1684,6 +1685,7 @@ public override async Task Reverse_in_projection_scalar_subquery(bool async) AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Reverse_after_orderby_thenby(bool async) { // Always throws for sync. diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/OwnedQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/OwnedQueryCosmosTest.cs index 3af0c85a9d3..56a1d000f6e 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/OwnedQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/OwnedQueryCosmosTest.cs @@ -63,6 +63,7 @@ ORDER BY c["Id"] }); [ConditionalTheory] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Navigation_rewrite_on_owned_collection_with_composition(bool async) { // Always throws for sync. @@ -668,6 +669,7 @@ FROM root c """); }); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Can_OrderBy_indexer_properties(bool async) { // Always throws for sync. @@ -689,6 +691,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Can_OrderBy_indexer_properties_converted(bool async) { // Always throws for sync. @@ -710,6 +713,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Can_OrderBy_owned_indexer_properties(bool async) { // Always throws for sync. @@ -731,6 +735,7 @@ FROM root c } } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Can_OrderBy_owned_indexer_properties_converted(bool async) { // Always throws for sync. @@ -805,6 +810,7 @@ public override Task Indexer_property_is_pushdown_into_subquery(bool async) () => base.Indexer_property_is_pushdown_into_subquery(async), CosmosStrings.NonCorrelatedSubqueriesNotSupported); + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override Task Can_query_indexer_property_on_owned_collection(bool async) => CosmosTestHelpers.Instance.NoSyncTest( async, async a => @@ -844,6 +850,7 @@ public override async Task Trying_to_access_non_existent_indexer_property_throws AssertSql(); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Ordering_by_identifying_projection(bool async) { // Always throws for sync. @@ -1228,6 +1235,7 @@ FROM root c }); [ConditionalTheory, MemberData(nameof(IsAsyncData))] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task OrderBy_ElementAt_over_owned_collection(bool async) { // Always throws for sync. diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs index 5881b3dd2f4..d5f5d5c7b4e 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs @@ -55,6 +55,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Count_with_zero_values() { await base.Inline_collection_Count_with_zero_values(); @@ -70,6 +71,7 @@ FROM a IN (SELECT VALUE []) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Count_with_one_value() { await base.Inline_collection_Count_with_one_value(); @@ -85,6 +87,7 @@ FROM a IN (SELECT VALUE [2]) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Count_with_two_values() { await base.Inline_collection_Count_with_two_values(); @@ -100,6 +103,7 @@ FROM a IN (SELECT VALUE [2, 999]) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Count_with_three_values() { await base.Inline_collection_Count_with_three_values(); @@ -239,6 +243,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Min_with_two_values() { await base.Inline_collection_Min_with_two_values(); @@ -253,6 +258,7 @@ FROM a IN (SELECT VALUE [30, c["Int"]])) = 30) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_List_Min_with_two_values() { await base.Inline_collection_List_Min_with_two_values(); @@ -267,6 +273,7 @@ FROM a IN (SELECT VALUE [30, c["Int"]])) = 30) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Max_with_two_values() { await base.Inline_collection_Max_with_two_values(); @@ -281,6 +288,7 @@ FROM a IN (SELECT VALUE [30, c["Int"]])) = 30) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_List_Max_with_two_values() { await base.Inline_collection_List_Max_with_two_values(); @@ -295,6 +303,7 @@ FROM a IN (SELECT VALUE [30, c["Int"]])) = 30) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Min_with_three_values() { await base.Inline_collection_Min_with_three_values(); @@ -311,6 +320,7 @@ FROM a IN (SELECT VALUE [30, c["Int"], @i])) = 25) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_List_Min_with_three_values() { await base.Inline_collection_List_Min_with_three_values(); @@ -327,6 +337,7 @@ FROM a IN (SELECT VALUE [30, c["Int"], @i])) = 25) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Max_with_three_values() { await base.Inline_collection_Max_with_three_values(); @@ -343,6 +354,7 @@ FROM a IN (SELECT VALUE [30, c["Int"], @i])) = 35) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_List_Max_with_three_values() { await base.Inline_collection_List_Max_with_three_values(); @@ -359,6 +371,7 @@ FROM a IN (SELECT VALUE [30, c["Int"], @i])) = 35) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_of_nullable_value_type_Min() { await base.Inline_collection_of_nullable_value_type_Min(); @@ -375,6 +388,7 @@ FROM a IN (SELECT VALUE [30, c["Int"], @i])) = 25) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_of_nullable_value_type_Max() { await base.Inline_collection_of_nullable_value_type_Max(); @@ -410,6 +424,7 @@ FROM a IN (SELECT VALUE [30, c["NullableInt"], @i])) = 30) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_of_nullable_value_type_with_null_Max() { await base.Inline_collection_of_nullable_value_type_with_null_Max(); @@ -436,6 +451,7 @@ public override async Task Inline_collection_with_single_parameter_element_Conta """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_with_single_parameter_element_Count() { await base.Inline_collection_with_single_parameter_element_Count(); @@ -481,6 +497,7 @@ WHERE ARRAY_CONTAINS(@Select, c["NullableString"]) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_Count_with_column_predicate_with_EF_Parameter() { await base.Inline_collection_Count_with_column_predicate_with_EF_Parameter(); @@ -498,6 +515,7 @@ FROM p IN (SELECT VALUE @p) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_in_query_filter() { await base.Inline_collection_in_query_filter(); @@ -514,6 +532,7 @@ OFFSET 0 LIMIT 2 """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Parameter_collection_Count() { await base.Parameter_collection_Count(); @@ -1261,6 +1280,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Column_collection_Count_with_predicate() { await base.Column_collection_Count_with_predicate(); @@ -1276,6 +1296,7 @@ FROM i IN c["Ints"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Column_collection_Where_Count() { await base.Column_collection_Where_Count(); @@ -1363,6 +1384,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_index_Column() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1385,6 +1407,7 @@ public override async Task Inline_collection_index_Column_with_EF_Constant() Assert.Equal(CoreStrings.EFConstantNotSupported, exception.Message); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_value_index_Column() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1400,6 +1423,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Inline_collection_List_value_index_Column() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1415,6 +1439,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Parameter_collection_index_Column_equal_Column() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1432,6 +1457,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Parameter_collection_index_Column_equal_constant() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1605,6 +1631,7 @@ FROM i IN c["Ints"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Column_collection_OrderByDescending_ElementAt() { // 'ORDER BY' is not supported in subqueries. @@ -1736,6 +1763,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Parameter_collection_with_type_inference_for_JsonScalarExpression() { // Member indexer (c.Array[c.SomeMember]) isn't supported by Cosmos @@ -1984,6 +2012,7 @@ ORDER BY c["Id"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Project_collection_of_ints_ordered() { // 'ORDER BY' is not supported in subqueries. @@ -2031,6 +2060,7 @@ ORDER BY c["Id"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Project_collection_of_nullable_ints_with_paging2() { // 'ORDER BY' is not supported in subqueries. @@ -2124,6 +2154,7 @@ ORDER BY c["Id"] """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Project_multiple_collections() { var exception = await Assert.ThrowsAsync(base.Project_multiple_collections); @@ -2247,6 +2278,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Values_of_enum_casted_to_underlying_value() { await base.Values_of_enum_casted_to_underlying_value(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/QueryLoggingCosmosTestBase.cs b/test/EFCore.Cosmos.FunctionalTests/Query/QueryLoggingCosmosTestBase.cs index 17c64286ef0..8b9bef82055 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/QueryLoggingCosmosTestBase.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/QueryLoggingCosmosTestBase.cs @@ -24,6 +24,7 @@ protected virtual bool ExpectSensitiveData => true; [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task Queryable_simple() { using var context = CreateContext(); @@ -64,6 +65,7 @@ FROM root c } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task Queryable_with_parameter_outputs_parameter_value_logging_warning() { using var context = CreateContext(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryDiscriminatorInIdTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryDiscriminatorInIdTest.cs index c479df7bf30..71fcd61df09 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryDiscriminatorInIdTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryDiscriminatorInIdTest.cs @@ -97,6 +97,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_hierarchical_partition_key(); @@ -123,6 +124,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key(); @@ -216,6 +218,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key(); @@ -488,6 +491,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task ReadItem_is_not_used_without_partition_key() { await base.ReadItem_is_not_used_without_partition_key(); @@ -618,6 +622,7 @@ public override async Task Predicate_with_only_single_partition_key_leaf() AssertSql("""ReadItem(["PK1c"], DerivedOnlySinglePartitionKeyEntity|PK1c)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_hierarchical_partition_key_leaf(); @@ -631,6 +636,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf(); @@ -724,6 +730,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key_leaf() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key(); @@ -911,6 +918,7 @@ public override async Task ReadItem_with_no_partition_key_leaf() AssertSql("""ReadItem(None, DerivedNoPartitionKeyEntity|11)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task ReadItem_is_not_used_without_partition_key_leaf() { await base.ReadItem_is_not_used_without_partition_key_leaf(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryNoDiscriminatorInIdTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryNoDiscriminatorInIdTest.cs index 0011bd6132d..507be7d02a1 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryNoDiscriminatorInIdTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryNoDiscriminatorInIdTest.cs @@ -94,6 +94,7 @@ public override async Task Predicate_with_only_single_partition_key() AssertSql("""ReadItem(["PK1a"], PK1a)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_hierarchical_partition_key(); @@ -120,6 +121,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key(); @@ -211,6 +213,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key(); @@ -395,6 +398,7 @@ public override async Task ReadItem_with_no_partition_key() AssertSql("""ReadItem(None, 1)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task ReadItem_is_not_used_without_partition_key() { await base.ReadItem_is_not_used_without_partition_key(); @@ -496,6 +500,7 @@ public override async Task Predicate_with_only_single_partition_key_leaf() AssertSql("""ReadItem(["PK1c"], PK1c)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_hierarchical_partition_key_leaf(); @@ -509,6 +514,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf(); @@ -600,6 +606,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key_leaf() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key_leaf(); @@ -784,6 +791,7 @@ public override async Task ReadItem_with_no_partition_key_leaf() AssertSql("""ReadItem(None, 11)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task ReadItem_is_not_used_without_partition_key_leaf() { await base.ReadItem_is_not_used_without_partition_key_leaf(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryRootDiscriminatorInIdTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryRootDiscriminatorInIdTest.cs index 8a46399b7d1..f55cf7429cc 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryRootDiscriminatorInIdTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryRootDiscriminatorInIdTest.cs @@ -85,6 +85,7 @@ public override async Task Predicate_with_only_single_partition_key() AssertSql("""ReadItem(["PK1a"], OnlySinglePartitionKeyEntity|PK1a)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_hierarchical_partition_key(); @@ -111,6 +112,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key(); @@ -204,6 +206,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key(); @@ -489,6 +492,7 @@ public override async Task Predicate_with_only_single_partition_key_leaf() AssertSql("""ReadItem(["PK1c"], OnlySinglePartitionKeyEntity|PK1c)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_hierarchical_partition_key_leaf(); @@ -502,6 +506,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key_leaf(); @@ -595,6 +600,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key_leaf() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key_leaf(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryTest.cs index db288cf5d7c..c828255dccd 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/ReadItemPartitionKeyQueryTest.cs @@ -87,6 +87,7 @@ public override async Task Predicate_with_only_single_partition_key() AssertSql("""ReadItem(["PK1a"], PK1a)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_hierarchical_partition_key(); @@ -114,6 +115,7 @@ FROM root c } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Predicate_with_partial_values_in_only_hierarchical_partition_key() { await base.Predicate_with_partial_values_in_only_hierarchical_partition_key(); @@ -203,6 +205,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task WithPartitionKey_with_partial_value_in_hierarchical_partition_key() { await base.WithPartitionKey_with_partial_value_in_hierarchical_partition_key(); @@ -387,6 +390,7 @@ public override async Task ReadItem_with_no_partition_key() AssertSql("""ReadItem(None, 1)"""); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task ReadItem_is_not_used_without_partition_key() { await base.ReadItem_is_not_used_without_partition_key(); diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/Translations/MathTranslationsCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/Translations/MathTranslationsCosmosTest.cs index f65838697ca..bd7c6e62628 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/Translations/MathTranslationsCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/Translations/MathTranslationsCosmosTest.cs @@ -292,6 +292,7 @@ FROM root c """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Truncate_project_and_order_by_it_twice() { // Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path. @@ -305,6 +306,7 @@ ORDER BY TRUNC(c["Double"]) """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Truncate_project_and_order_by_it_twice2() { // Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path. @@ -318,6 +320,7 @@ ORDER BY TRUNC(c["Double"]) DESC """); } + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public override async Task Truncate_project_and_order_by_it_twice3() { // Unsupported ORDER BY clause. ORDER BY item expression could not be mapped to a document path. diff --git a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosCondition.cs b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosCondition.cs index d3ab1d3120c..8f29a4da780 100644 --- a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosCondition.cs +++ b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosCondition.cs @@ -10,4 +10,5 @@ public enum CosmosCondition DoesNotUseTokenCredential = 1 << 1, IsEmulator = 1 << 2, IsNotEmulator = 1 << 3, + IsNotLinuxEmulator = 1 << 4, } diff --git a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosConditionAttribute.cs b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosConditionAttribute.cs index 3a80eb3317f..a268f8ef5a3 100644 --- a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosConditionAttribute.cs +++ b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosConditionAttribute.cs @@ -34,6 +34,11 @@ public ValueTask IsMetAsync() isMet &= !TestEnvironment.IsEmulator; } + if (Conditions.HasFlag(CosmosCondition.IsNotLinuxEmulator)) + { + isMet &= !TestEnvironment.IsLinuxEmulator; + } + return ValueTask.FromResult(isMet); } diff --git a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosTestStore.cs b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosTestStore.cs index 0d56c570a44..2cb8cbdb14a 100644 --- a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosTestStore.cs +++ b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosTestStore.cs @@ -90,12 +90,26 @@ protected override DbContext CreateDefaultContext() => new TestStoreContext(this); public override DbContextOptionsBuilder AddProviderOptions(DbContextOptionsBuilder builder) - => TestEnvironment.UseTokenCredential + { + var result = TestEnvironment.UseTokenCredential ? builder.UseCosmos(ConnectionUri, TokenCredential, Name, _configureCosmos) : builder.UseCosmos(ConnectionUri, AuthToken, Name, _configureCosmos); + if (TestEnvironment.IsLinuxEmulator) + { + result.AddInterceptors(LinuxEmulatorSaveChangesInterceptor.Instance); + } + + return result; + } + public static async ValueTask IsConnectionAvailableAsync() { + if (TestEnvironment.SkipConnectionCheck) + { + return true; + } + if (_connectionAvailable == null) { await _connectionSemaphore.WaitAsync(); diff --git a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/LinuxEmulatorSaveChangesInterceptor.cs b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/LinuxEmulatorSaveChangesInterceptor.cs new file mode 100644 index 00000000000..668e93169c1 --- /dev/null +++ b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/LinuxEmulatorSaveChangesInterceptor.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Diagnostics; + +namespace Microsoft.EntityFrameworkCore.TestUtilities; + +/// +/// Interceptor that forces on every SaveChanges call. +/// The Linux (vnext) Cosmos emulator does not support transactional batches, so this interceptor +/// ensures all writes are sent individually rather than batched. +/// +public sealed class LinuxEmulatorSaveChangesInterceptor : SaveChangesInterceptor +{ + public static LinuxEmulatorSaveChangesInterceptor Instance { get; } = new(); + + public override InterceptionResult SavingChanges(DbContextEventData eventData, InterceptionResult result) + { + if (eventData.Context != null) + { + eventData.Context.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never; + } + + return result; + } + + public override ValueTask> SavingChangesAsync( + DbContextEventData eventData, + InterceptionResult result, + CancellationToken cancellationToken = default) + { + if (eventData.Context != null) + { + eventData.Context.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never; + } + + return ValueTask.FromResult(result); + } +} diff --git a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/TestEnvironment.cs b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/TestEnvironment.cs index 37c0d2d4d0a..b51f94f0da1 100644 --- a/test/EFCore.Cosmos.FunctionalTests/TestUtilities/TestEnvironment.cs +++ b/test/EFCore.Cosmos.FunctionalTests/TestUtilities/TestEnvironment.cs @@ -32,7 +32,7 @@ public static class TestEnvironment public static string ConnectionString { get; } = $"AccountEndpoint={DefaultConnection};AccountKey={AuthToken}"; - public static bool UseTokenCredential { get; } = Config["UseTokenCredential"] == "true"; + public static bool UseTokenCredential { get; } = string.Equals(Config["UseTokenCredential"], "true", StringComparison.OrdinalIgnoreCase); public static TokenCredential TokenCredential { get; } = new AzureCliCredential( new AzureCliCredentialOptions { ProcessTimeout = TimeSpan.FromMinutes(5) }); @@ -46,4 +46,11 @@ public static class TestEnvironment : Enum.Parse(Config["AzureLocation"]); public static bool IsEmulator { get; } = !UseTokenCredential && (AuthToken == _emulatorAuthToken); + + public static bool SkipConnectionCheck { get; } = string.Equals(Config["SkipConnectionCheck"], "true", StringComparison.OrdinalIgnoreCase); + + public static string EmulatorType { get; } = Config["EmulatorType"] ?? (!OperatingSystem.IsWindows() ? "linux" : ""); + + public static bool IsLinuxEmulator { get; } = IsEmulator + && EmulatorType.Equals("linux", StringComparison.OrdinalIgnoreCase); } diff --git a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosMiscellaneousTypeTest.cs b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosMiscellaneousTypeTest.cs index 918cae035d4..f1917c61751 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosMiscellaneousTypeTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosMiscellaneousTypeTest.cs @@ -6,6 +6,10 @@ namespace Microsoft.EntityFrameworkCore.Types.Miscellaneous; public class CosmosBoolTypeTest(CosmosBoolTypeTest.BoolTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class BoolTypeFixture : CosmosTypeFixtureBase { public override bool Value { get; } = true; @@ -18,6 +22,10 @@ public class BoolTypeFixture : CosmosTypeFixtureBase public class CosmosStringTypeTest(CosmosStringTypeTest.StringTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class StringTypeFixture : CosmosTypeFixtureBase { public override string Value { get; } = "foo"; diff --git a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosNumericTypeTest.cs b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosNumericTypeTest.cs index 5211f1fe934..50e8064dc80 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosNumericTypeTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosNumericTypeTest.cs @@ -22,6 +22,10 @@ public class ByteTypeFixture : CosmosTypeFixtureBase public class CosmosShortTypeTest(CosmosShortTypeTest.ShortTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class ShortTypeFixture : CosmosTypeFixtureBase { public override short Value { get; } = short.MinValue; @@ -33,6 +37,10 @@ public class ShortTypeFixture : CosmosTypeFixtureBase public class CosmosIntTypeTest(CosmosIntTypeTest.IntTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class IntTypeFixture : CosmosTypeFixtureBase { public override int Value { get; } = int.MinValue; @@ -45,6 +53,10 @@ public class IntTypeFixture : CosmosTypeFixtureBase public class CosmosLongTypeTest(CosmosLongTypeTest.LongTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class LongTypeFixture : CosmosTypeFixtureBase { public override long Value { get; } = long.MinValue; @@ -57,6 +69,10 @@ public class LongTypeFixture : CosmosTypeFixtureBase public class CosmosDecimalTypeTest(CosmosDecimalTypeTest.DecimalTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class DecimalTypeFixture : CosmosTypeFixtureBase { public override decimal Value { get; } = 30.5m; @@ -69,6 +85,10 @@ public class DecimalTypeFixture : CosmosTypeFixtureBase public class CosmosDoubleTypeTest(CosmosDoubleTypeTest.DoubleTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class DoubleTypeFixture : CosmosTypeFixtureBase { public override double Value { get; } = 30.5d; @@ -81,6 +101,10 @@ public class DoubleTypeFixture : CosmosTypeFixtureBase public class CosmosFloatTypeTest(CosmosFloatTypeTest.FloatTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class FloatTypeFixture : CosmosTypeFixtureBase { public override float Value { get; } = 30.5f; diff --git a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosTemporalTypeTest.cs b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosTemporalTypeTest.cs index 0ed50c258c7..e631121dfd5 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Types/CosmosTemporalTypeTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Types/CosmosTemporalTypeTest.cs @@ -6,6 +6,10 @@ namespace Microsoft.EntityFrameworkCore.Types.Temporal; public class CosmosDateTimeTypeTest(CosmosDateTimeTypeTest.DateTimeTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class DateTimeTypeFixture : CosmosTypeFixtureBase { public override DateTime Value { get; } = new DateTime(2020, 1, 5, 12, 30, 45, DateTimeKind.Unspecified); @@ -18,6 +22,10 @@ public class DateTimeTypeFixture : CosmosTypeFixtureBase public class CosmosDateTimeOffsetTypeTest(CosmosDateTimeOffsetTypeTest.DateTimeOffsetTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class DateTimeOffsetTypeFixture : CosmosTypeFixtureBase { public override DateTimeOffset Value { get; } = new DateTimeOffset(2020, 1, 5, 12, 30, 45, TimeSpan.FromHours(2)); @@ -29,6 +37,10 @@ public class DateTimeOffsetTypeFixture : CosmosTypeFixtureBase public class CosmosDateOnlyTypeTest(CosmosDateOnlyTypeTest.DateOnlyTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class DateOnlyTypeFixture : CosmosTypeFixtureBase { public override DateOnly Value { get; } = new DateOnly(2020, 1, 5); @@ -41,6 +53,10 @@ public class DateOnlyTypeFixture : CosmosTypeFixtureBase public class CosmosTimeOnlyTypeTest(CosmosTimeOnlyTypeTest.TimeOnlyTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class TimeOnlyTypeFixture : CosmosTypeFixtureBase { public override TimeOnly Value { get; } = new TimeOnly(12, 30, 45); @@ -52,6 +68,10 @@ public class TimeOnlyTypeFixture : CosmosTypeFixtureBase public class CosmosTimeSpanTypeTest(CosmosTimeSpanTypeTest.TimeSpanTypeFixture fixture) : TypeTestBase(fixture) { + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] + public override Task Primitive_collection_in_query() + => base.Primitive_collection_in_query(); + public class TimeSpanTypeFixture : CosmosTypeFixtureBase { public override TimeSpan Value { get; } = new TimeSpan(12, 30, 45); diff --git a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkConcurrencyTest.cs b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkConcurrencyTest.cs index e1a6cbf2d0c..cba49a51feb 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkConcurrencyTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkConcurrencyTest.cs @@ -3,6 +3,7 @@ namespace Microsoft.EntityFrameworkCore.Update; +[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public class CosmosBulkConcurrencyTest(CosmosBulkConcurrencyTest.ConcurrencyFixture fixture) : CosmosConcurrencyTest(fixture), IClassFixture { public class ConcurrencyFixture : CosmosConcurrencyTest.CosmosFixture diff --git a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkExecutionTest.cs b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkExecutionTest.cs index 78e3e119364..f2bf7971be1 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkExecutionTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkExecutionTest.cs @@ -10,6 +10,7 @@ public class CosmosBulkExecutionTest(NonSharedFixture fixture) : NonSharedModelT protected override ITestStoreFactory NonSharedTestStoreFactory => CosmosTestStoreFactory.Instance; [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task DoesNotBatchSingleBatchableWrite() { var contextFactory = await InitializeNonSharedTest(onConfiguring: (cfg) => cfg.UseCosmos(c => c.BulkExecutionEnabled()).ConfigureWarnings(x => x.Ignore(CosmosEventId.BulkExecutionWithTransactionalBatch))); diff --git a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkWarningTest.cs b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkWarningTest.cs index b4ddb9b910b..466d05471d2 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkWarningTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Update/CosmosBulkWarningTest.cs @@ -20,6 +20,7 @@ public virtual async Task AutoTransactionBehaviorNever_DoesNotThrow() } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task AutoTransactionBehaviorWhenNeeded_Throws() { using var context = fixture.CreateContext(); @@ -31,6 +32,7 @@ public virtual async Task AutoTransactionBehaviorWhenNeeded_Throws() } [ConditionalFact] + [CosmosCondition(CosmosCondition.IsNotLinuxEmulator)] public virtual async Task AutoTransactionBehaviorAlways_Throws() { using var context = fixture.CreateContext();