Skip to content

Commit

Permalink
Skip sync tests in Cosmos
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed May 31, 2024
1 parent 16acc46 commit a385034
Show file tree
Hide file tree
Showing 31 changed files with 4,729 additions and 6,328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ public class ConcurrencyDetectorDisabledCosmosTest(ConcurrencyDetectorDisabledCo
public override Task Any(bool async)
=> base.Any(async);

public override Task SaveChanges(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.SaveChanges(a));

public override Task Count(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Count(a));

public override Task Find(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Find(a));

public override Task First(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.First(a));

public override Task Last(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Last(a));

public override Task Single(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Single(a));

public override Task ToList(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.ToList(a));

public class ConcurrencyDetectorCosmosFixture : ConcurrencyDetectorFixtureBase
{
protected override ITestStoreFactory TestStoreFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ public override void GroupBy_converted_enum()
public override void Infer_type_mapping_from_in_subquery_to_item()
=> Assert.Throws<InvalidOperationException>(() => base.Infer_type_mapping_from_in_subquery_to_item());

public override Task Can_query_custom_type_not_mapped_by_default_equality(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Can_query_custom_type_not_mapped_by_default_equality(a));

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
30 changes: 15 additions & 15 deletions test/EFCore.Cosmos.FunctionalTests/FindCosmosTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,49 @@ public override Task Find_derived_using_base_set_type_from_store_async(Cancellat
=> Task.CompletedTask;

public override void Find_int_key_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_int_key_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_int_key_from_store());

public override void Returns_null_for_int_key_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_int_key_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_int_key_not_in_store());

public override void Find_nullable_int_key_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_nullable_int_key_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_nullable_int_key_from_store());

public override void Returns_null_for_nullable_int_key_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_nullable_int_key_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_nullable_int_key_not_in_store());

public override void Find_string_key_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_string_key_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_string_key_from_store());

public override void Returns_null_for_string_key_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_string_key_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_string_key_not_in_store());

public override void Find_composite_key_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_composite_key_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_composite_key_from_store());

public override void Returns_null_for_composite_key_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_composite_key_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_composite_key_not_in_store());

public override void Find_base_type_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_base_type_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_base_type_from_store());

public override void Returns_null_for_base_type_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_base_type_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_base_type_not_in_store());

public override void Find_derived_type_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_derived_type_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_derived_type_from_store());

public override void Returns_null_for_derived_type_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_derived_type_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_derived_type_not_in_store());

public override void Find_base_type_using_derived_set_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_base_type_using_derived_set_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_base_type_using_derived_set_from_store());

public override void Find_shadow_key_from_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Find_shadow_key_from_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Find_shadow_key_from_store());

public override void Returns_null_for_shadow_key_not_in_store()
=> CosmosTestHelpers.Instance.NoSyncTest(() => base.Returns_null_for_shadow_key_not_in_store());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(() => base.Returns_null_for_shadow_key_not_in_store());

public class FindCosmosTestSet(FindCosmosFixture fixture) : FindCosmosTest(fixture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ public class MaterializationInterceptionCosmosTest :
public override Task Intercept_query_materialization_with_owned_types_projecting_collection(bool async, bool usePooling)
=> Task.CompletedTask;

public override Task Intercept_query_materialization_with_owned_types(bool async, bool usePooling)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Intercept_query_materialization_with_owned_types(a, usePooling));

public class CosmosLibraryContext(DbContextOptions options) : LibraryContext(options)
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,54 +45,17 @@ public override Task Attempting_to_add_same_relationship_twice_for_many_to_many_

// Uses lazy-loader, which is always sync
public override Task Two_concurrency_issues_in_one_to_one_related_entities_can_be_handled_by_dealing_with_dependent_first()
=> CosmosTestHelpers.Instance.NoSyncTest(
false,
_ => base.Two_concurrency_issues_in_one_to_one_related_entities_can_be_handled_by_dealing_with_dependent_first());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(
() => base.Two_concurrency_issues_in_one_to_one_related_entities_can_be_handled_by_dealing_with_dependent_first());

// Uses lazy-loader, which is always sync
public override Task Two_concurrency_issues_in_one_to_many_related_entities_can_be_handled_by_dealing_with_dependent_first()
=> CosmosTestHelpers.Instance.NoSyncTest(
false,
_ => base.Two_concurrency_issues_in_one_to_many_related_entities_can_be_handled_by_dealing_with_dependent_first());
=> CosmosTestHelpers.Instance.AssertSyncNotSupported(
() => base.Two_concurrency_issues_in_one_to_many_related_entities_can_be_handled_by_dealing_with_dependent_first());

protected override IDbContextTransaction BeginTransaction(DatabaseFacade facade)
=> new FakeDbContextTransaction();

public override Task Calling_Reload_on_an_Added_entity_that_is_not_in_database_is_no_op(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Calling_Reload_on_an_Added_entity_that_is_not_in_database_is_no_op(a));

public override Task Calling_Reload_on_an_Unchanged_entity_that_is_not_in_database_detaches_it(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(
async, a => base.Calling_Reload_on_an_Unchanged_entity_that_is_not_in_database_detaches_it(a));

public override Task Calling_Reload_on_a_Modified_entity_that_is_not_in_database_detaches_it(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(
async, a => base.Calling_Reload_on_a_Modified_entity_that_is_not_in_database_detaches_it(a));

public override Task Calling_Reload_on_a_Deleted_entity_that_is_not_in_database_detaches_it(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(
async, a => base.Calling_Reload_on_a_Deleted_entity_that_is_not_in_database_detaches_it(a));

public override Task Calling_Reload_on_a_Detached_entity_that_is_not_in_database_detaches_it(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(
async, a => base.Calling_Reload_on_a_Detached_entity_that_is_not_in_database_detaches_it(a));

public override Task Calling_Reload_on_an_Unchanged_entity_makes_the_entity_unchanged(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Calling_Reload_on_an_Unchanged_entity_makes_the_entity_unchanged(a));

public override Task Calling_Reload_on_a_Modified_entity_makes_the_entity_unchanged(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Calling_Reload_on_a_Modified_entity_makes_the_entity_unchanged(a));

public override Task Calling_Reload_on_a_Deleted_entity_makes_the_entity_unchanged(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Calling_Reload_on_a_Deleted_entity_makes_the_entity_unchanged(a));

public override Task Calling_Reload_on_an_Added_entity_that_was_saved_elsewhere_makes_the_entity_unchanged(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(
async, a => base.Calling_Reload_on_an_Added_entity_that_was_saved_elsewhere_makes_the_entity_unchanged(a));

public override Task Calling_Reload_on_a_Detached_entity_makes_the_entity_unchanged(bool async)
=> CosmosTestHelpers.Instance.NoSyncTest(async, a => base.Calling_Reload_on_a_Detached_entity_makes_the_entity_unchanged(a));

private class FakeDbContextTransaction : IDbContextTransaction
{
public Guid TransactionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

// Skip the entire assembly if cannot connect to CosmosDb

using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;

[assembly: CosmosDbConfiguredCondition]

// Waiting on Task causes deadlocks when run in parallel
[assembly: CollectionBehavior(DisableTestParallelization = true)]

// Cosmos doesn't support sync I/O
[assembly: SkipSyncTests]
Loading

0 comments on commit a385034

Please sign in to comment.