From 56ad9f9e8726b8085bc578a78003536d04ee0f47 Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Thu, 17 Sep 2026 02:14:13 -0400 Subject: [PATCH 1/2] test: reproduce BerkeleyDb Release warnings --- .github/workflows/pull-request.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index b5ea1ebd..ef63fb20 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -53,8 +53,8 @@ jobs: run: dotnet test ${{ env.SOLUTION_PATH }} -c ${{ env.CONFIGURATION }} --no-build --no-restore --logger trx - name: Restore HDB01 BerkeleyDb tests run: dotnet restore ${{ env.BERKELEYDB_TEST_PROJECT }} - - name: Test HDB01 BerkeleyDb package foundation - run: dotnet test ${{ env.BERKELEYDB_TEST_PROJECT }} -c ${{ env.CONFIGURATION }} --no-restore --logger trx -p:ContinuousIntegrationBuild=true + - name: Test BerkeleyDb release configuration + run: dotnet test ${{ env.BERKELEYDB_TEST_PROJECT }} -c Release --no-restore --logger trx -p:ContinuousIntegrationBuild=true - name: Pack coordinated Staging packages if: matrix.package_host shell: pwsh From 98724895441189c9039a5c6196319f80543b43bd Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Thu, 17 Sep 2026 02:18:49 -0400 Subject: [PATCH 2/2] test: await BerkeleyDb concurrency tasks --- .../src/Hdb05CatalogReaderTests.cs | 27 ++++++++++++++----- .../src/Hdb07LifecycleHardeningTests.cs | 4 +-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb05CatalogReaderTests.cs b/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb05CatalogReaderTests.cs index b7cb027b..2adac0b9 100644 --- a/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb05CatalogReaderTests.cs +++ b/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb05CatalogReaderTests.cs @@ -679,10 +679,10 @@ public void EmptyDatabaseReturnsAnEmptyImmutableSnapshot() { } [Fact] - public void ConcurrentReadsUseIndependentLimitSnapshots() { - WithDatabase( + public async Task ConcurrentReadsUseIndependentLimitSnapshots() { + await WithDatabaseAsync( CreateCatalogStore( "sample", "sample-alias" ), - path => { + async path => { BerkeleyDbTerminalCatalogReader accepted = new( path, @@ -700,15 +700,15 @@ public void ConcurrentReadsUseIndependentLimitSnapshots() { Task> success = Task.Run( () => accepted.Read() ); - Task failure = + Task failure = Task.Run( () => Record.Exception( () => rejected.Read() ) ); - Task.WaitAll( success, failure ); + await Task.WhenAll( success, failure ); - Assert.Equal( 2, success.Result.Count ); + Assert.Equal( 2, ( await success ).Count ); Assert.IsType( - failure.Result + await failure ); } ); @@ -1014,6 +1014,19 @@ Action assertion } } + private static async Task WithDatabaseAsync( + byte[] database, + Func assertion + ) { + string path = Path.GetTempFileName(); + try { + File.WriteAllBytes( path, database ); + await assertion( path ); + } finally { + File.Delete( path ); + } + } + private static void WithTwoDatabases( byte[] first, byte[] second, diff --git a/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb07LifecycleHardeningTests.cs b/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb07LifecycleHardeningTests.cs index c78a71f6..d09ba666 100644 --- a/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb07LifecycleHardeningTests.cs +++ b/tests/Icod.TermInfo.BerkeleyDb.Tests/src/Hdb07LifecycleHardeningTests.cs @@ -112,7 +112,7 @@ public void CatalogReturnsFreshSnapshotsAndHonorsPreCancellation() { } [Fact] - public void ConcurrentExplicitProvidersKeepResourceLimitsIndependent() { + public async Task ConcurrentExplicitProvidersKeepResourceLimitsIndependent() { using TemporaryRoot temporary = new(); string path = temporary.GetPath( "limits.db" ); string name = "hdb07-limits"; @@ -134,7 +134,7 @@ public void ConcurrentExplicitProvidersKeepResourceLimitsIndependent() { () => rejected.TryLoad( name, out _ ) ) ); - Task.WaitAll( success, failure ); + await Task.WhenAll( success, failure ); AssertFileCanBeOpenedExclusively( path ); }