From 847bcdabe3098ba0e5e2dcdeab467d4b92d3015a Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Tue, 22 Oct 2024 07:45:21 -0500 Subject: [PATCH] Stabilizing CoreTests in CI Trying to isolate another test Trying to isolate another test Trying to isolate a test Trying to isolate a test removing some tests from CI for troubleshooting Trying to isolate a test Trying to better isolate a unit test trying to address a failing test on CI Trying to isolate a test better Trying to isolate a test that's unreliable a bit more Added a missing await in a test turning off all CI tests but Marten.Testing --- ...h-do-ci-build-pg12-plv8-systemtextjson.yml | 25 ------------------- .../on-push-do-ci-build-pg15-jsonnet.yml | 25 ------------------- ...sh-do-ci-build-pgLatest-systemtextjson.yml | 25 ------------------- .../MartenServiceCollectionExtensionsTests.cs | 5 ++++ src/CoreTests/create_database_Tests.cs | 8 +++--- src/CoreTests/retry_mechanism.cs | 10 ++++---- ...g_multiple_document_stores_in_same_host.cs | 8 +++++- src/DocumentDbTests/Reading/query_plans.cs | 6 +---- .../query_against_child_collections.cs | 8 +++--- ...ssible_to_use_Serializable_transactions.cs | 2 +- 10 files changed, 27 insertions(+), 95 deletions(-) rename src/{CoreTests => StressTests}/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs (98%) diff --git a/.github/workflows/on-push-do-ci-build-pg12-plv8-systemtextjson.yml b/.github/workflows/on-push-do-ci-build-pg12-plv8-systemtextjson.yml index 9cbb8e8a59..8c579e1342 100644 --- a/.github/workflows/on-push-do-ci-build-pg12-plv8-systemtextjson.yml +++ b/.github/workflows/on-push-do-ci-build-pg12-plv8-systemtextjson.yml @@ -112,26 +112,6 @@ jobs: run: ./build.sh test-core shell: bash - - name: test-document-db - if: ${{ success() || failure() }} - run: ./build.sh test-document-db - shell: bash - - - name: test-event-sourcing - if: ${{ success() || failure() }} - run: ./build.sh test-event-sourcing - shell: bash - - - name: test-cli - if: ${{ success() || failure() }} - run: ./build.sh test-cli - shell: bash - - - name: test-linq - if: ${{ success() || failure() }} - run: ./build.sh test-linq - shell: bash - # - name: test-multi-tenancy # if: ${{ success() || failure() }} # run: ./build.sh test-multi-tenancy @@ -142,11 +122,6 @@ jobs: run: ./build.sh test-patching shell: bash - - name: test-value-types - if: ${{ success() || failure() }} - run: ./build.sh test-value-types - shell: bash - - name: test-code-gen if: ${{ success() || failure() }} run: ./build.sh test-code-gen diff --git a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml index 80d6d62be4..3388ebe02c 100644 --- a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml +++ b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml @@ -105,26 +105,6 @@ jobs: run: ./build.sh test-core shell: bash - - name: test-document-db - if: ${{ success() || failure() }} - run: ./build.sh test-document-db - shell: bash - - - name: test-event-sourcing - if: ${{ success() || failure() }} - run: ./build.sh test-event-sourcing - shell: bash - - - name: test-cli - if: ${{ success() || failure() }} - run: ./build.sh test-cli - shell: bash - - - name: test-linq - if: ${{ success() || failure() }} - run: ./build.sh test-linq - shell: bash - # - name: test-multi-tenancy # if: ${{ success() || failure() }} # run: ./build.sh test-multi-tenancy @@ -135,11 +115,6 @@ jobs: run: ./build.sh test-patching shell: bash - - name: test-value-types - if: ${{ success() || failure() }} - run: ./build.sh test-value-types - shell: bash - - name: test-code-gen if: ${{ success() || failure() }} run: ./build.sh test-code-gen diff --git a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml index 25818c1eb2..8960529b98 100644 --- a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml +++ b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml @@ -105,26 +105,6 @@ jobs: run: ./build.sh test-core shell: bash - - name: test-document-db - if: ${{ success() || failure() }} - run: ./build.sh test-document-db - shell: bash - - - name: test-event-sourcing - if: ${{ success() || failure() }} - run: ./build.sh test-event-sourcing - shell: bash - - - name: test-cli - if: ${{ success() || failure() }} - run: ./build.sh test-cli - shell: bash - - - name: test-linq - if: ${{ success() || failure() }} - run: ./build.sh test-linq - shell: bash - # - name: test-multi-tenancy # if: ${{ success() || failure() }} # run: ./build.sh test-multi-tenancy @@ -135,11 +115,6 @@ jobs: run: ./build.sh test-patching shell: bash - - name: test-value-types - if: ${{ success() || failure() }} - run: ./build.sh test-value-types - shell: bash - - name: test-code-gen if: ${{ success() || failure() }} run: ./build.sh test-code-gen diff --git a/src/CoreTests/MartenServiceCollectionExtensionsTests.cs b/src/CoreTests/MartenServiceCollectionExtensionsTests.cs index 55b987245f..c5e8e20769 100644 --- a/src/CoreTests/MartenServiceCollectionExtensionsTests.cs +++ b/src/CoreTests/MartenServiceCollectionExtensionsTests.cs @@ -152,6 +152,10 @@ public async Task apply_changes_on_startup() // The normal Marten configuration services.AddMarten(opts => { + // This helps isolate a test, not something you need to do + // in normal usage + opts.ApplyChangesLockId += 18; + opts.Connection(ConnectionSource.ConnectionString); opts.RegisterDocumentType(); }) @@ -186,6 +190,7 @@ public async Task assert_configuration_on_startup() { opts.Connection(ConnectionSource.ConnectionString); opts.RegisterDocumentType(); + opts.DatabaseSchemaName = "startup"; }) .AssertDatabaseMatchesConfigurationOnStartup(); }); diff --git a/src/CoreTests/create_database_Tests.cs b/src/CoreTests/create_database_Tests.cs index 6a562f03db..aee350eee1 100644 --- a/src/CoreTests/create_database_Tests.cs +++ b/src/CoreTests/create_database_Tests.cs @@ -107,11 +107,11 @@ public async Task can_use_existing_database_without_calling_into_create() { var user1 = new User { FirstName = "User" }; var dbCreated = false; - using var store = DocumentStore.For(_ => + using var store = DocumentStore.For(opts => { - _.AutoCreateSchemaObjects = AutoCreate.All; - _.Connection(ConnectionSource.ConnectionString); - _.CreateDatabasesForTenants(c => + opts.AutoCreateSchemaObjects = AutoCreate.All; + opts.Connection(ConnectionSource.ConnectionString); + opts.CreateDatabasesForTenants(c => { c.MaintenanceDatabase(ConnectionSource.ConnectionString); c.ForTenant() diff --git a/src/CoreTests/retry_mechanism.cs b/src/CoreTests/retry_mechanism.cs index 2fec10db27..94057769c2 100644 --- a/src/CoreTests/retry_mechanism.cs +++ b/src/CoreTests/retry_mechanism.cs @@ -14,15 +14,13 @@ namespace CoreTests; -public class retry_mechanism : IntegrationContext +public class retry_mechanism : OneOffConfigurationsContext { - public retry_mechanism(DefaultStoreFixture fixture) : base(fixture) - { - } - [Fact] public async Task can_successfully_retry() { + StoreOptions(opts => opts.DatabaseSchemaName = "retries"); + var sometimesFailingOperation1 = new SometimesFailingOperation(); theSession.QueueOperation(sometimesFailingOperation1); @@ -35,6 +33,8 @@ public async Task can_successfully_retry() [Fact] public async Task can_successfully_retry_sync() { + StoreOptions(opts => opts.DatabaseSchemaName = "retries"); + var sometimesFailingOperation1 = new SometimesFailingOperation(); theSession.QueueOperation(sometimesFailingOperation1); diff --git a/src/CoreTests/using_multiple_document_stores_in_same_host.cs b/src/CoreTests/using_multiple_document_stores_in_same_host.cs index df3bce0bd8..d59617aa58 100644 --- a/src/CoreTests/using_multiple_document_stores_in_same_host.cs +++ b/src/CoreTests/using_multiple_document_stores_in_same_host.cs @@ -128,10 +128,14 @@ public void all_the_defaults() { using var container = Container.For(services => { - services.AddMarten(ConnectionSource.ConnectionString); + services.AddMarten(opts => + { + opts.Connection(ConnectionSource.ConnectionString); + }); services.AddMartenStore(opts => { + opts.ApplyChangesLockId += 17; opts.Connection(ConnectionSource.ConnectionString); opts.DatabaseSchemaName = "first_store"; }); @@ -370,8 +374,10 @@ public async Task apply_changes_on_startup() x.AddLogging(); x.AddMartenStore(opts => { + opts.ApplyChangesLockId += 19; opts.Connection(ConnectionSource.ConnectionString); opts.RegisterDocumentType(); + opts.DatabaseSchemaName = "first_store"; }) .ApplyAllDatabaseChangesOnStartup(); }); diff --git a/src/DocumentDbTests/Reading/query_plans.cs b/src/DocumentDbTests/Reading/query_plans.cs index 45e1711d0d..a0eb835451 100644 --- a/src/DocumentDbTests/Reading/query_plans.cs +++ b/src/DocumentDbTests/Reading/query_plans.cs @@ -12,12 +12,8 @@ namespace DocumentDbTests.Reading; -public class query_plans : IntegrationContext +public class query_plans : OneOffConfigurationsContext { - public query_plans(DefaultStoreFixture fixture) : base(fixture) - { - } - [Fact] public async Task query_by_query_plan() { diff --git a/src/LinqTests/ChildCollections/query_against_child_collections.cs b/src/LinqTests/ChildCollections/query_against_child_collections.cs index 4b28a5aad4..e137967bd1 100644 --- a/src/LinqTests/ChildCollections/query_against_child_collections.cs +++ b/src/LinqTests/ChildCollections/query_against_child_collections.cs @@ -347,15 +347,15 @@ public async Task query_string_array_intersects_array() } [Fact] - public void query_string_list_intersects_array() + public async Task query_string_list_intersects_array() { - buildAuthorData(); + await buildAuthorData(); var interests = new[] { "health", "astrology" }; - var res = theSession.Query
() + var res = await theSession.Query
() .Where(x => x.CategoryList.Any(s => interests.Contains(s))) .OrderBy(x => x.Long) - .ToList(); + .ToListAsync(); res.Count.ShouldBe(2); res[0].Long.ShouldBe(1); diff --git a/src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs b/src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs similarity index 98% rename from src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs rename to src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs index f957efc083..e93199e841 100644 --- a/src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs +++ b/src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs @@ -6,7 +6,7 @@ using Shouldly; using Xunit; -namespace CoreTests.Bugs; +namespace StressTests.Bugs; public class Bug616Account {