diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml
index 465e1475f..e066d109d 100644
--- a/.github/workflows/test-windows.yml
+++ b/.github/workflows/test-windows.yml
@@ -40,6 +40,11 @@ jobs:
- name: Build
run: dotnet build -c Release --verbosity minimal
+ - name: Setup Testcontainers Cloud Client
+ uses: atomicjar/testcontainers-cloud-setup-action@v1
+ with:
+ token: ${{ secrets.TC_CLOUD_TOKEN }}
+
- name: 'Tests: Unit'
uses: ./.github/workflows/test
with:
@@ -57,7 +62,7 @@ jobs:
- name: Build agent-zip
run: ./build.bat agent-zip
-
+
- name: 'Tests: StartupHooks'
uses: ./.github/workflows/test
with:
@@ -67,7 +72,7 @@ jobs:
profiler-tests:
runs-on: windows-2022
# Disable profiler tests for now
- if: ${{ false }}
+ # if: ${{ false }}
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
@@ -78,6 +83,11 @@ jobs:
- name: Build profiler
run: ./build.bat profiler-zip
+ - name: Setup Testcontainers Cloud Client
+ uses: atomicjar/testcontainers-cloud-setup-action@v1
+ with:
+ token: ${{ secrets.TC_CLOUD_TOKEN }}
+
- name: 'Tests: Profiler'
uses: ./.github/workflows/test
with:
diff --git a/test/Elastic.Apm.Tests.Utilities/Docker/DockerFactAttribute.cs b/test/Elastic.Apm.Tests.Utilities/Docker/DockerFactAttribute.cs
index 4058c6168..910305267 100644
--- a/test/Elastic.Apm.Tests.Utilities/Docker/DockerFactAttribute.cs
+++ b/test/Elastic.Apm.Tests.Utilities/Docker/DockerFactAttribute.cs
@@ -20,12 +20,6 @@ static DockerFactAttribute()
{
try
{
- if (TestEnvironment.IsCi && TestEnvironment.IsWindows)
- {
- _skip = "not running tests that require docker in CI on Windows";
- return;
- }
-
var result = Proc.Start(new StartArguments("docker", "--version"));
if (result.ExitCode != 0)
_skip = "docker not installed";
diff --git a/test/Elastic.Apm.Tests.Utilities/Docker/DockerTheoryAttribute.cs b/test/Elastic.Apm.Tests.Utilities/Docker/DockerTheoryAttribute.cs
index 3e4395a96..b94e8c31e 100644
--- a/test/Elastic.Apm.Tests.Utilities/Docker/DockerTheoryAttribute.cs
+++ b/test/Elastic.Apm.Tests.Utilities/Docker/DockerTheoryAttribute.cs
@@ -20,12 +20,6 @@ static DockerTheoryAttribute()
{
try
{
- if (TestEnvironment.IsCi && TestEnvironment.IsWindows)
- {
- _skip = "not running tests that require docker in CI on Windows";
- return;
- }
-
var result = Proc.Start(new StartArguments("docker", "--version"));
if (result.ExitCode != 0)
_skip = "docker not installed";
diff --git a/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsFact.cs b/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsFact.cs
index 78c89bea2..db38c1813 100644
--- a/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsFact.cs
+++ b/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsFact.cs
@@ -18,17 +18,6 @@ public DisabledOnWindowsFact()
}
}
-public sealed class DisabledOnFullFrameworkFact : FactAttribute
-{
- public DisabledOnFullFrameworkFact()
- {
-#if NETFRAMEWORK
-
- Skip = "This test is disabled on .NET Full Framework";
-#endif
- }
-}
-
public sealed class DisabledOnNet462FrameworkFact : FactAttribute
{
public DisabledOnNet462FrameworkFact()
@@ -39,36 +28,5 @@ public DisabledOnNet462FrameworkFact()
}
}
-///
-/// May be applied to tests which depend on Linux Docker images which will not be
-/// available when running on Windows images from GitHub actions.
-///
-public sealed class DisabledOnWindowsGitHubActionsDockerFact : DockerFactAttribute
-{
- public DisabledOnWindowsGitHubActionsDockerFact()
- {
- if (TestEnvironment.IsGitHubActions && TestEnvironment.IsWindows)
- Skip = "This test is disabled on Windows when running under GitHub Actions.";
- }
-}
-
-public sealed class DisabledOnWindowsTheory : TheoryAttribute
-{
- public DisabledOnWindowsTheory()
- {
- if (TestEnvironment.IsWindows)
- Skip = "This test is disabled on Windows.";
- }
-}
-
-public sealed class DisabledOnFullFrameworkTheory : TheoryAttribute
-{
- public DisabledOnFullFrameworkTheory()
- {
-#if NETFRAMEWORK
- Skip = "This test is disabled on .NET Full Framework";
-#endif
- }
-}
#pragma warning restore IDE0021 // Use expression body for constructor
diff --git a/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsTheory.cs b/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsTheory.cs
new file mode 100644
index 000000000..1217f926d
--- /dev/null
+++ b/test/Elastic.Apm.Tests.Utilities/XUnit/DisabledOnWindowsTheory.cs
@@ -0,0 +1,17 @@
+// Licensed to Elasticsearch B.V under
+// one or more agreements.
+// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
+// See the LICENSE file in the project root for more information
+
+using Xunit;
+
+namespace Elastic.Apm.Tests.Utilities.XUnit;
+
+public sealed class DisabledOnWindowsTheory : TheoryAttribute
+{
+ public DisabledOnWindowsTheory()
+ {
+ if (TestEnvironment.IsWindows)
+ Skip = "This test is disabled on Windows.";
+ }
+}
diff --git a/test/instrumentations/Elastic.Apm.Elasticsearch.Tests/ElasticsearchTests.cs b/test/instrumentations/Elastic.Apm.Elasticsearch.Tests/ElasticsearchTests.cs
index a02cc7285..31faf115c 100644
--- a/test/instrumentations/Elastic.Apm.Elasticsearch.Tests/ElasticsearchTests.cs
+++ b/test/instrumentations/Elastic.Apm.Elasticsearch.Tests/ElasticsearchTests.cs
@@ -9,6 +9,7 @@
using Elastic.Apm.Api;
using Elastic.Apm.DiagnosticSource;
using Elastic.Apm.Tests.Utilities;
+using Elastic.Apm.Tests.Utilities.Docker;
using Elastic.Apm.Tests.Utilities.XUnit;
using Elasticsearch.Net;
using FluentAssertions;
@@ -28,7 +29,7 @@ public ElasticsearchTests(ElasticsearchFixture fixture)
_client = new ElasticLowLevelClient(settings);
}
- [DisabledOnWindowsGitHubActionsDockerFact]
+ [DockerFact]
public async Task Elasticsearch_Span_Should_Align_With_Spec()
{
var payloadSender = new MockPayloadSender();
@@ -86,7 +87,7 @@ private static void AssertSpan(ISpan span)
span.Context.Destination.Port.Should().BeGreaterThan(0).And.BeLessThan(65536);
}
- [DisabledOnWindowsGitHubActionsDockerFact]
+ [DockerFact]
public async Task Elasticsearch_Span_Does_Not_Have_Http_Child_Span()
{
var payloadSender = new MockPayloadSender();
diff --git a/test/instrumentations/Elastic.Apm.MongoDb.Tests/MongoApmTests.cs b/test/instrumentations/Elastic.Apm.MongoDb.Tests/MongoApmTests.cs
index b843ef8d8..5313d1ad1 100644
--- a/test/instrumentations/Elastic.Apm.MongoDb.Tests/MongoApmTests.cs
+++ b/test/instrumentations/Elastic.Apm.MongoDb.Tests/MongoApmTests.cs
@@ -10,6 +10,7 @@
using Elastic.Apm.Api;
using Elastic.Apm.MongoDb.Tests.Fixture;
using Elastic.Apm.Tests.Utilities;
+using Elastic.Apm.Tests.Utilities.Docker;
using Elastic.Apm.Tests.Utilities.XUnit;
using FluentAssertions;
using MongoDB.Bson;
@@ -64,7 +65,7 @@ public Task DisposeAsync(IMongoCollection collection) =>
private readonly MockPayloadSender _payloadSender;
- [DisabledOnWindowsFact]
+ [DockerFact]
public async Task ApmAgent_ShouldCorrectlyCaptureSpan()
{
// Arrange
@@ -101,7 +102,7 @@ public async Task ApmAgent_ShouldCorrectlyCaptureSpan()
});
}
- [DisabledOnWindowsFact]
+ [DockerFact]
public async Task ApmAgent_ShouldCorrectlyCaptureSpanAndError_WhenMongoCommandFailed()
{
// Arrange
diff --git a/test/instrumentations/Elastic.Apm.SqlClient.Tests/EfCoreWithMsSqlTests.cs b/test/instrumentations/Elastic.Apm.SqlClient.Tests/EfCoreWithMsSqlTests.cs
index b9977b98e..7c1cccbb1 100644
--- a/test/instrumentations/Elastic.Apm.SqlClient.Tests/EfCoreWithMsSqlTests.cs
+++ b/test/instrumentations/Elastic.Apm.SqlClient.Tests/EfCoreWithMsSqlTests.cs
@@ -8,6 +8,7 @@
using Elastic.Apm.EntityFrameworkCore;
using Elastic.Apm.Instrumentations.SqlClient;
using Elastic.Apm.Tests.Utilities;
+using Elastic.Apm.Tests.Utilities.Docker;
using Elastic.Apm.Tests.Utilities.XUnit;
using FluentAssertions;
using Microsoft.EntityFrameworkCore;
@@ -43,7 +44,7 @@ public EfCoreWithMsSqlTests(ITestOutputHelper testOutputHelper, SqlServerFixture
/// Executes a db query within a transaction while both SqlClient and EFCore capturing is active.
/// Makes sure that the db call is only captured once - so only 1 of them captures the call, the other one ignores it.
///
- [DisabledOnWindowsFact]
+ [DockerFact]
public void BothEfCoreAndSqlClientCapturingActive()
{
var dbContextOptionsBuilder = new DbContextOptionsBuilder();
diff --git a/test/instrumentations/Elastic.Apm.SqlClient.Tests/Elastic.Apm.SqlClient.Tests.csproj b/test/instrumentations/Elastic.Apm.SqlClient.Tests/Elastic.Apm.SqlClient.Tests.csproj
index 0f99a966f..b4906f29d 100644
--- a/test/instrumentations/Elastic.Apm.SqlClient.Tests/Elastic.Apm.SqlClient.Tests.csproj
+++ b/test/instrumentations/Elastic.Apm.SqlClient.Tests/Elastic.Apm.SqlClient.Tests.csproj
@@ -22,4 +22,8 @@
+
+
+
+
diff --git a/test/instrumentations/Elastic.Apm.SqlClient.Tests/SqlClientListenerTests.cs b/test/instrumentations/Elastic.Apm.SqlClient.Tests/SqlClientListenerTests.cs
index 785cb6fd1..d43650a79 100644
--- a/test/instrumentations/Elastic.Apm.SqlClient.Tests/SqlClientListenerTests.cs
+++ b/test/instrumentations/Elastic.Apm.SqlClient.Tests/SqlClientListenerTests.cs
@@ -11,6 +11,7 @@
using Elastic.Apm.Api;
using Elastic.Apm.Instrumentations.SqlClient;
using Elastic.Apm.Tests.Utilities;
+using Elastic.Apm.Tests.Utilities.Docker;
using Elastic.Apm.Tests.Utilities.XUnit;
using FluentAssertions;
using Xunit;
@@ -38,9 +39,10 @@ public SqlClientListenerTests(ITestOutputHelper testOutputHelper, SqlServerFixtu
_testOutputHelper = testOutputHelper;
- _payloadSender = new MockPayloadSender();
+ var logger = new LineWriterToLoggerAdaptor(new XunitOutputToLineWriterAdaptor(_testOutputHelper));
+ _payloadSender = new MockPayloadSender(logger);
_apmAgent = new ApmAgent(new TestAgentComponents(
- new LineWriterToLoggerAdaptor(new XunitOutputToLineWriterAdaptor(_testOutputHelper)),
+ logger,
payloadSender: _payloadSender));
_subscription = _apmAgent.Subscribe(new SqlClientDiagnosticSubscriber());
}
@@ -63,7 +65,7 @@ public static IEnumerable