From 6fa5cc849ea850d9e8ef0249d56b1049e6b7e287 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Mon, 7 Mar 2022 08:37:10 +0100 Subject: [PATCH] Ensured stability of DB tests. * 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. --- Build.ps1 | 13 +------------ .../TestUtils/DatabaseFixture.cs | 2 +- .../TestUtils/TestCategory.cs | 1 - .../TransactionTests.cs | 1 - 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 693bfaaa..09680f83 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -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 diff --git a/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/DatabaseFixture.cs b/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/DatabaseFixture.cs index bc2ae973..b4c07400 100644 --- a/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/DatabaseFixture.cs +++ b/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/DatabaseFixture.cs @@ -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}], diff --git a/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/TestCategory.cs b/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/TestCategory.cs index 3cab8f65..927b70e2 100644 --- a/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/TestCategory.cs +++ b/test/Serilog.Sinks.MSSqlServer.Tests/TestUtils/TestCategory.cs @@ -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); } } diff --git a/test/Serilog.Sinks.MSSqlServer.Tests/TransactionTests.cs b/test/Serilog.Sinks.MSSqlServer.Tests/TransactionTests.cs index 1d8324d1..22022715 100644 --- a/test/Serilog.Sinks.MSSqlServer.Tests/TransactionTests.cs +++ b/test/Serilog.Sinks.MSSqlServer.Tests/TransactionTests.cs @@ -6,7 +6,6 @@ namespace Serilog.Sinks.MSSqlServer.Tests { - [Trait(TestCategory.TraitName, TestCategory.Isolated)] public class TransactionTests : DatabaseTestsBase { public TransactionTests(ITestOutputHelper output) : base(output)