Skip to content

Commit

Permalink
Ensured stability of DB tests.
Browse files Browse the repository at this point in the history
* Increased connection timeout when deleting or creating DB in DB tests (enables stable parallel execution of all DB tests including the transaction test).
* Let all tests execute in one run again. No more separation of transaction DB test necessary.
  • Loading branch information
ckadluba committed Mar 7, 2022
1 parent 2b58582 commit 6fa5cc8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
13 changes: 1 addition & 12 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,7 @@ if ($SkipTests -eq $false) {

echo "build: Testing project in $test"

& dotnet test -c Release --filter "Category!=Isolated"
if($LASTEXITCODE -ne 0) { exit 3 }

Pop-Location
}

foreach ($test in ls test/*.Tests) {
Push-Location $test

echo "build: Running isolated tests in $test"

& dotnet test -c Release --filter "Category=Isolated"
& dotnet test -c Release
if($LASTEXITCODE -ne 0) { exit 3 }

Pop-Location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Serilog.Sinks.MSSqlServer.Tests.TestUtils
public sealed class DatabaseFixture : IDisposable
{

private const string _masterConnectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Master;Integrated Security=True";
private const string _masterConnectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Master;Integrated Security=True;Connect Timeout=120";
private const string _createLogEventsDatabase = @"
EXEC ('CREATE DATABASE [{0}] ON PRIMARY
(NAME = [{0}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public static class TestCategory
public const string TraitName = "Category";

public const string Integration = nameof(Integration);
public const string Isolated = nameof(Isolated);
public const string Unit = nameof(Unit);
}
}
1 change: 0 additions & 1 deletion test/Serilog.Sinks.MSSqlServer.Tests/TransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Serilog.Sinks.MSSqlServer.Tests
{
[Trait(TestCategory.TraitName, TestCategory.Isolated)]
public class TransactionTests : DatabaseTestsBase
{
public TransactionTests(ITestOutputHelper output) : base(output)
Expand Down

0 comments on commit 6fa5cc8

Please sign in to comment.