Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -700,15 +700,15 @@ public void ConcurrentReadsUseIndependentLimitSnapshots() {

Task<IReadOnlyList<BerkeleyDbTerminalCatalogEntry>> success =
Task.Run( () => accepted.Read() );
Task<Exception?> failure =
Task<Exception> 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<BerkeleyDbDatabaseFormatException>(
failure.Result
await failure
);
}
);
Expand Down Expand Up @@ -1014,6 +1014,19 @@ Action<string> assertion
}
}

private static async Task WithDatabaseAsync(
byte[] database,
Func<string, Task> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -134,7 +134,7 @@ public void ConcurrentExplicitProvidersKeepResourceLimitsIndependent() {
() => rejected.TryLoad( name, out _ )
)
);
Task.WaitAll( success, failure );
await Task.WhenAll( success, failure );

AssertFileCanBeOpenedExclusively( path );
}
Expand Down
Loading