Skip to content

Commit 6662a9b

Browse files
committed
Use ICollectionFixture for each one
1 parent eb926bc commit 6662a9b

File tree

7 files changed

+28
-22
lines changed

7 files changed

+28
-22
lines changed

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/DapperTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet
1313
{
1414
[Trait("RequiresDockerDependency", "true")]
1515
[Trait("DockerGroup", "1")]
16-
[Collection(ContainersCollection.Name)]
16+
[Collection(PostgresCollection.Name)]
1717
public class DapperTests : TracingIntegrationTest
1818
{
1919
public DapperTests(ITestOutputHelper output, PostgresFixture postgresFixture)

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/NpgsqlCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Datadog.Trace.ClrProfiler.IntegrationTests.AdoNet
2121
{
2222
[Trait("RequiresDockerDependency", "true")]
2323
[Trait("DockerGroup", "1")]
24-
[Collection(ContainersCollection.Name)]
24+
[Collection(PostgresCollection.Name)]
2525
[UsesVerify]
2626
public class NpgsqlCommandTests : TracingIntegrationTest
2727
{

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AerospikeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Datadog.Trace.ClrProfiler.IntegrationTests
2020
{
2121
[Trait("RequiresDockerDependency", "true")]
2222
[Trait("DockerGroup", "2")]
23-
[Collection(ContainersCollection.Name)]
23+
[Collection(AerospikeCollection.Name)]
2424
[UsesVerify]
2525
public class AerospikeTests : TracingIntegrationTest
2626
{

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/ContainersCollection.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,25 @@
99
namespace Datadog.Trace.ClrProfiler.IntegrationTests;
1010

1111
/// <summary>
12-
/// Collection definition for TestContainers.
13-
/// Using ICollectionFixture ensures that ONE instance of each fixture is shared across all test classes
14-
/// in the collection, and disposed when all tests complete. This prevents race conditions and
15-
/// eliminates the need for reference counting.
12+
/// Collection definition for Postgres tests.
13+
/// Using ICollectionFixture ensures that ONE PostgresFixture instance is shared across all test classes
14+
/// in this collection. The container starts when the first test runs and stops when the last test finishes.
1615
/// </summary>
1716
[CollectionDefinition(Name)]
18-
public class ContainersCollection :
19-
ICollectionFixture<PostgresFixture>,
20-
ICollectionFixture<AerospikeFixture>
17+
public class PostgresCollection : ICollectionFixture<PostgresFixture>
2118
{
22-
public const string Name = "TestContainers";
19+
public const string Name = "Postgres";
2320
}
21+
22+
/// <summary>
23+
/// Collection definition for Aerospike tests.
24+
/// Using ICollectionFixture ensures that ONE AerospikeFixture instance is shared across all test classes
25+
/// in this collection. The container starts when the first test runs and stops when the last test finishes.
26+
/// </summary>
27+
#pragma warning disable SA1402 // File may only contain a single type
28+
[CollectionDefinition(Name)]
29+
public class AerospikeCollection : ICollectionFixture<AerospikeFixture>
30+
{
31+
public const string Name = "Aerospike";
32+
}
33+
#pragma warning restore SA1402 // File may only contain a single type

tracer/test/Datadog.Trace.Security.IntegrationTests/ContainersCollection.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
44
// </copyright>
55

6-
using System;
7-
using System.Threading.Tasks;
86
using Datadog.Trace.TestHelpers.AutoInstrumentation.Containers;
97
using Xunit;
108

119
namespace Datadog.Trace.Security.IntegrationTests;
1210

1311
/// <summary>
14-
/// Collection definition for TestContainers.
15-
/// Using ICollectionFixture ensures that ONE instance of each fixture is shared across all test classes
16-
/// in the collection, and disposed when all tests complete. This prevents race conditions and
17-
/// eliminates the need for reference counting.
12+
/// Collection definition for Postgres tests.
13+
/// Using ICollectionFixture ensures that ONE PostgresFixture instance is shared across all test classes
14+
/// in this collection. The container starts when the first test runs and stops when the last test finishes.
1815
/// </summary>
1916
[CollectionDefinition(Name)]
20-
public class ContainersCollection : ICollectionFixture<PostgresFixture>
17+
public class PostgresCollection : ICollectionFixture<PostgresFixture>
2118
{
22-
public const string Name = "TestContainers";
19+
public const string Name = "Postgres";
2320
}

tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/AspNetCore2IastTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,7 @@ protected override async Task TryStartApp()
652652
}
653653
}
654654

655-
[Collection(ContainersCollection.Name)]
656-
public abstract class AspNetCore2IastTests : AspNetBase, IClassFixture<AspNetCoreTestFixture>, IClassFixture<PostgresFixture>
655+
public abstract class AspNetCore2IastTests : AspNetBase, IClassFixture<AspNetCoreTestFixture>
657656
{
658657
public AspNetCore2IastTests(AspNetCoreTestFixture fixture, ITestOutputHelper outputHelper, bool enableIast, string testName, bool? isIastDeduplicationEnabled = null, int? samplingRate = null, int? vulnerabilitiesPerRequest = null, bool? redactionEnabled = false, int iastTelemetryLevel = (int)IastMetricsVerbosityLevel.Off)
659658
: this(fixture, null, outputHelper, enableIast, testName, isIastDeduplicationEnabled, samplingRate, vulnerabilitiesPerRequest, redactionEnabled, iastTelemetryLevel)

tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/AspNetCore5IastDbTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace Datadog.Trace.Security.IntegrationTests.IAST;
1717

1818
[Trait("RequiresDockerDependency", "true")]
19-
[Collection(ContainersCollection.Name)]
19+
[Collection(PostgresCollection.Name)]
2020
public class AspNetCore5IastDbTests : AspNetCore5IastTests
2121
{
2222
public AspNetCore5IastDbTests(AspNetCoreTestFixture fixture, PostgresFixture postgresFixture, ITestOutputHelper outputHelper)

0 commit comments

Comments
 (0)