diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 56edc5952..43c486f92 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -148,8 +148,6 @@ jobs: - name: 'Tests: Profiler' uses: ./.github/workflows/test - #temporarily disable profiler tests - if: false with: name: 'profiler' project: 'test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj' diff --git a/ElasticApmAgent.sln b/ElasticApmAgent.sln index 8d1aeedd1..53989af2a 100644 --- a/ElasticApmAgent.sln +++ b/ElasticApmAgent.sln @@ -18,6 +18,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{267A241E-571F-458F-B04C-B6C4DE79E735}" ProjectSection(SolutionItems) = preProject test\Directory.Build.props = test\Directory.Build.props + test\xunit.runner.json = test\xunit.runner.json EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Apm", "src\Elastic.Apm\Elastic.Apm.csproj", "{90BC9629-C8D2-4FD5-863E-EA2D5FB37341}" diff --git a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/Elastic.Clients.Elasticsearch.Tests.csproj b/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/Elastic.Clients.Elasticsearch.Tests.csproj index 3c75cf2b9..a67d81364 100644 --- a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/Elastic.Clients.Elasticsearch.Tests.csproj +++ b/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/Elastic.Clients.Elasticsearch.Tests.csproj @@ -20,6 +20,6 @@ - + diff --git a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/xunit.runner.json b/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/xunit.runner.json deleted file mode 100644 index 68790c3cc..000000000 --- a/test/instrumentations/Elastic.Clients.Elasticsearch.Tests/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", - "diagnosticMessages": true -} \ No newline at end of file diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleManagedDataAccessCoreCommandTests.cs b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleManagedDataAccessCoreCommandTests.cs index d33c9e341..4d35c28e7 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleManagedDataAccessCoreCommandTests.cs +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleManagedDataAccessCoreCommandTests.cs @@ -32,6 +32,9 @@ public OracleManagedDataAccessCoreCommandTests(OracleSqlFixture fixture, ITestOu [ClassData(typeof(AdoNetTestData))] public async Task CaptureAutoInstrumentedSpans(string targetFramework) { + if (!TestEnvironment.IsWindows) + return; + var apmLogger = new InMemoryBlockingLogger(Elastic.Apm.Logging.LogLevel.Error); var apmServer = new MockApmServer(apmLogger, nameof(CaptureAutoInstrumentedSpans)); var port = apmServer.FindAvailablePortToListen(); diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleSqlFixture.cs b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleSqlFixture.cs index f868db9ee..1a4ccab12 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleSqlFixture.cs +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/OracleSqlFixture.cs @@ -4,8 +4,11 @@ // See the LICENSE file in the project root for more information using System.Threading.Tasks; +using Elastic.Apm.Tests.Utilities; using Testcontainers.Oracle; using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; namespace Elastic.Apm.Profiler.Managed.Tests.AdoNet { @@ -15,10 +18,24 @@ public sealed class OracleCollection : ICollectionFixture { } public sealed class OracleSqlFixture : IAsyncLifetime { private readonly OracleContainer _container = new OracleBuilder().Build(); + private readonly IMessageSink _sink; public string ConnectionString => _container.GetConnectionString(); - public Task InitializeAsync() => _container.StartAsync(); + public OracleSqlFixture(IMessageSink sink) => _sink = sink; + + public async Task InitializeAsync() + { + if (!TestEnvironment.IsWindows) + return; + + await _container.StartAsync(); + var (stdOut, stdErr) = await _container.GetLogsAsync(); + + _sink.OnMessage(new DiagnosticMessage(stdOut)); + _sink.OnMessage(new DiagnosticMessage(stdErr)); + + } public Task DisposeAsync() => _container.DisposeAsync().AsTask(); } diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj index 782c06f3b..1bf473894 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj @@ -26,4 +26,8 @@ + + + + diff --git a/test/xunit.runner.json b/test/xunit.runner.json new file mode 100644 index 000000000..9c5ec42ee --- /dev/null +++ b/test/xunit.runner.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "diagnosticMessages": true, + "internalDiagnosticMessages": true, + "longRunningTestSeconds": 2 +} \ No newline at end of file