From dca42ebfa51f002880ba7cfe8e4fd228e46f2082 Mon Sep 17 00:00:00 2001
From: Martijn Bodeman <11424653+skwasjer@users.noreply.github.com>
Date: Sun, 6 Oct 2024 07:15:14 +0200
Subject: [PATCH] test: disable xunit's AppDomain which seems to have been
causing the issue with random CI failures (on mono). (#126)
---
.github/workflows/main.yml | 4 ++--
.github/workflows/sonarcloud.yml | 2 +-
.../MockHttp.Json.Tests.csproj | 4 ----
.../MockHttp.Server.Tests.csproj | 4 ----
test/MockHttp.Testing/XunitAppDomainUnloadHook.cs | 15 ---------------
test/MockHttp.Tests/MockHttp.Tests.csproj | 4 ----
6 files changed, 3 insertions(+), 30 deletions(-)
delete mode 100644 test/MockHttp.Testing/XunitAppDomainUnloadHook.cs
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cf06e561..d3e31949 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -122,9 +122,9 @@ jobs:
name: build
# Run all tests
- - run: dotnet test --no-restore --no-build -c Release
+ - run: dotnet test --no-restore --no-build -c Release -- xUnit.AppDomain=denied
if: matrix.os == 'ubuntu-latest'
- - run: dotnet test --no-restore --no-build -c Release --filter Category!=PublicApi
+ - run: dotnet test --no-restore --no-build -c Release --filter Category!=PublicApi -- xUnit.AppDomain=denied
if: matrix.os != 'ubuntu-latest'
pack:
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
index 9967ecbe..b5768c73 100644
--- a/.github/workflows/sonarcloud.yml
+++ b/.github/workflows/sonarcloud.yml
@@ -81,6 +81,6 @@ jobs:
run: |
dotnet sonarscanner begin /k:"$SONAR_PROJECT_KEY" /o:"$SONAR_ORG_KEY" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths="**/*opencover.xml" $SONAR_PR_ARGS
- dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="test/**/*.cs" /p:VerifyPublicApi=false
+ dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="test/**/*.cs" /p:VerifyPublicApi=false -- xUnit.AppDomain=denied
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"
diff --git a/test/MockHttp.Json.Tests/MockHttp.Json.Tests.csproj b/test/MockHttp.Json.Tests/MockHttp.Json.Tests.csproj
index 6aa238f0..aec30bd1 100644
--- a/test/MockHttp.Json.Tests/MockHttp.Json.Tests.csproj
+++ b/test/MockHttp.Json.Tests/MockHttp.Json.Tests.csproj
@@ -8,10 +8,6 @@
MockHttp.Json
-
-
-
-
diff --git a/test/MockHttp.Server.Tests/MockHttp.Server.Tests.csproj b/test/MockHttp.Server.Tests/MockHttp.Server.Tests.csproj
index acd249a5..02a93888 100644
--- a/test/MockHttp.Server.Tests/MockHttp.Server.Tests.csproj
+++ b/test/MockHttp.Server.Tests/MockHttp.Server.Tests.csproj
@@ -8,10 +8,6 @@
MockHttp
-
-
-
-
diff --git a/test/MockHttp.Testing/XunitAppDomainUnloadHook.cs b/test/MockHttp.Testing/XunitAppDomainUnloadHook.cs
deleted file mode 100644
index 14736be4..00000000
--- a/test/MockHttp.Testing/XunitAppDomainUnloadHook.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace MockHttp;
-
-public sealed class XunitAppDomainUnloadHook
-{
- [Fact]
- public void Unload()
- {
- AppDomain.CurrentDomain.DomainUnload += (_, _) =>
- {
- GC.Collect();
- GC.WaitForPendingFinalizers();
- };
- Assert.True(true);
- }
-}
diff --git a/test/MockHttp.Tests/MockHttp.Tests.csproj b/test/MockHttp.Tests/MockHttp.Tests.csproj
index 1f751dac..aee4f3b9 100644
--- a/test/MockHttp.Tests/MockHttp.Tests.csproj
+++ b/test/MockHttp.Tests/MockHttp.Tests.csproj
@@ -8,10 +8,6 @@
MockHttp
-
-
-
-