Skip to content

Commit

Permalink
re-enable profiler tests (#2199)
Browse files Browse the repository at this point in the history
* re-enable profiler tests

* ensure Oracle docker never runs on linux

* dotnet format
  • Loading branch information
Mpdreamz authored Oct 17, 2023
1 parent 205ad9a commit 6dc0d8b
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions ElasticApmAgent.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
</ItemGroup>

<ItemGroup>
<None Update="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="..\..\xunit.runner.json" Link="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -15,10 +18,24 @@ public sealed class OracleCollection : ICollectionFixture<OracleSqlFixture> { }
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@
<PackageReference Include="System.Data.SqlClient" Version="4.8.5"/>
</ItemGroup>

<ItemGroup>
<Content Include="..\..\xunit.runner.json" Link="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions test/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"diagnosticMessages": true,
"internalDiagnosticMessages": true,
"longRunningTestSeconds": 2
}

0 comments on commit 6dc0d8b

Please sign in to comment.