Skip to content

Commit ded578a

Browse files
vazoisCopilot
andcommitted
Fix Allure wiring: remove duplicate [AllureNUnit] and fix CI check for transitive dependencies
- Remove duplicate [AllureNUnit] from derived test classes (TLS, AsyncReplay, MultiLog) that inherit it from base classes, fixing runtime error 'Unable to change the container context because the test context is active' - Fix CI Allure wiring check to search AppDomain.GetAssemblies() instead of using Assembly.Load() on direct references, which failed for AllureTestBase in transitive dependencies (e.g. Garnet.test.cluster via Garnet.test.cluster.replication) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 39b0aad commit ded578a

5 files changed

Lines changed: 5 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ jobs:
113113
}
114114
$allureBase = $types | Where-Object { $_.Name -eq "AllureTestBase" }
115115
if (-not $allureBase) {
116-
# AllureTestBase may be in a referenced assembly (e.g., child test projects referencing a base test project)
117-
foreach ($refAsm in $asm.GetReferencedAssemblies()) {
116+
# AllureTestBase may be in a transitive dependency already loaded by the runtime during GetTypes().
117+
# Search all loaded assemblies in the AppDomain rather than only direct references.
118+
foreach ($loaded in [System.AppDomain]::CurrentDomain.GetAssemblies()) {
118119
try {
119-
$loaded = [System.Reflection.Assembly]::Load($refAsm)
120-
$allureBase = $loaded.GetTypes() | Where-Object { $_.Name -eq "AllureTestBase" }
120+
try { $refTypes = $loaded.GetTypes() } catch [System.Reflection.ReflectionTypeLoadException] { $refTypes = $_.Exception.Types | Where-Object { $_ -ne $null } }
121+
$allureBase = $refTypes | Where-Object { $_.Name -eq "AllureTestBase" }
121122
if ($allureBase) { break }
122123
} catch { }
123124
}

test/Garnet.test.cluster.multilog/MultiLogTests/ClusterReplicationDisklessSyncShardedLog.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Reflection;
7-
using Allure.NUnit;
87
using NUnit.Framework;
98

109
namespace Garnet.test.cluster.MultiLogTests
1110
{
1211
[TestFixture]
13-
[AllureNUnit]
1412
[NonParallelizable]
1513
public class ClusterReplicationDisklessSyncShardedLog : ClusterReplicationDisklessSyncTests
1614
{

test/Garnet.test.cluster.multilog/MultiLogTests/ClusterReplicationShardedLog.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
using System.Reflection;
99
using System.Text;
1010
using System.Threading.Tasks;
11-
using Allure.NUnit;
1211
using NUnit.Framework;
1312
using NUnit.Framework.Legacy;
1413
using StackExchange.Redis;
1514

1615
namespace Garnet.test.cluster.MultiLogTests
1716
{
1817
[TestFixture]
19-
[AllureNUnit]
2018
[NonParallelizable]
2119
public class ClusterReplicationShardedLog : ClusterReplicationBaseTests
2220
{

test/Garnet.test.cluster.replication.asyncreplay/ReplicationTests/ClusterReplicationAsyncReplay.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
using Allure.NUnit;
54
using NUnit.Framework;
65

76
namespace Garnet.test.cluster
87
{
98
[TestFixture]
10-
[AllureNUnit]
119
[NonParallelizable]
1210
[Ignore("Skip to reduce CI duration.")]
1311
public class ClusterReplicationAsyncReplay : ClusterReplicationBaseTests

test/Garnet.test.cluster.replication.tls/ReplicationTests/ClusterReplicationTLS.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
using Allure.NUnit;
54
using NUnit.Framework;
65

76
namespace Garnet.test.cluster
87
{
98
[TestFixture]
10-
[AllureNUnit]
119
[NonParallelizable]
1210
public class ClusterReplicationTLS : ClusterReplicationBaseTests
1311
{

0 commit comments

Comments
 (0)