-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial work for 8T integration tests. * no need to instrument StartAgent method * Refactors InfiniteTracingTests to cover different framework testing. Changes the target framework in ConsoleDynamicMethodFixtureCoreLatest to "net5.0" * 8T supportability metric assertions are enough, scraping for InfiniteTracing log messages is unnecessary. * Adds comments. * Added trace observer entry to example secrets file Co-authored-by: Alex Hemsath <[email protected]>
- Loading branch information
1 parent
be90787
commit fa79047
Showing
13 changed files
with
209 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
tests/Agent/IntegrationTests/IntegrationTests/InfiniteTracing/InfiniteTracingTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Collections.Generic; | ||
using MultiFunctionApplicationHelpers; | ||
using NewRelic.Agent.IntegrationTestHelpers; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace NewRelic.Agent.IntegrationTests.InfiniteTracing | ||
{ | ||
public abstract class InfiniteTracingTestsBase<TFixture> : NewRelicIntegrationTest<TFixture> | ||
where TFixture : ConsoleDynamicMethodFixture | ||
{ | ||
private readonly TFixture _fixture; | ||
|
||
public InfiniteTracingTestsBase(TFixture fixture, ITestOutputHelper output):base(fixture) | ||
{ | ||
_fixture = fixture; | ||
_fixture.SetTimeout(System.TimeSpan.FromMinutes(2)); | ||
_fixture.TestLogger = output; | ||
|
||
_fixture.AddCommand($"InfiniteTracingTester StartAgent"); | ||
_fixture.AddCommand($"InfiniteTracingTester Make8TSpan"); | ||
_fixture.AddCommand($"InfiniteTracingTester Wait"); | ||
|
||
|
||
_fixture.Actions | ||
( | ||
setupConfiguration: () => | ||
{ | ||
var configModifier = new NewRelicConfigModifier(fixture.DestinationNewRelicConfigFilePath); | ||
|
||
configModifier.ForceTransactionTraces() | ||
.EnableDistributedTrace() | ||
.EnableInfinteTracing(_fixture.TestConfiguration.TraceObserverUrl) | ||
.SetLogLevel("finest"); | ||
} | ||
); | ||
|
||
_fixture.Initialize(); | ||
} | ||
|
||
[Fact] | ||
public void Test() | ||
{ | ||
//1 span count for the Make8TSpan method, another span count for the root span. | ||
var expectedSeenCount = 2; | ||
var expectedSentCount = 2; | ||
var expectedReceivedCount = 2; | ||
|
||
var actualMetrics = new List<Assertions.ExpectedMetric> | ||
{ | ||
new Assertions.ExpectedMetric { metricName = @"Supportability/InfiniteTracing/Span/Seen", callCount = expectedSeenCount }, | ||
new Assertions.ExpectedMetric { metricName = @"Supportability/InfiniteTracing/Span/Sent", callCount = expectedSentCount }, | ||
new Assertions.ExpectedMetric { metricName = @"Supportability/InfiniteTracing/Span/Received", callCount = expectedReceivedCount } | ||
}; | ||
|
||
var metrics = _fixture.AgentLog.GetMetrics(); | ||
Assertions.MetricsExist(actualMetrics, metrics); | ||
} | ||
} | ||
|
||
[NetFrameworkTest] | ||
public class InfiniteTracingFWLatestTests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureFWLatest> | ||
{ | ||
public InfiniteTracingFWLatestTests(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
|
||
[NetFrameworkTest] | ||
public class InfiniteTracingFW471Tests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureFW471> | ||
{ | ||
public InfiniteTracingFW471Tests(ConsoleDynamicMethodFixtureFW471 fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
[NetFrameworkTest] | ||
public class InfiniteTracingFW461Tests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureFW461> | ||
{ | ||
public InfiniteTracingFW461Tests(ConsoleDynamicMethodFixtureFW461 fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
[NetCoreTest] | ||
public class InfiniteTracingNetCoreLatestTests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureCoreLatest> | ||
{ | ||
public InfiniteTracingNetCoreLatestTests(ConsoleDynamicMethodFixtureCoreLatest fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
[NetCoreTest] | ||
public class InfiniteTracingNetCore31Tests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureCore31> | ||
{ | ||
public InfiniteTracingNetCore31Tests(ConsoleDynamicMethodFixtureCore31 fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
[NetCoreTest] | ||
public class InfiniteTracingNetCore21Tests : InfiniteTracingTestsBase<ConsoleDynamicMethodFixtureCore21> | ||
{ | ||
public InfiniteTracingNetCore21Tests(ConsoleDynamicMethodFixtureCore21 fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...ions/Common/MultiFunctionApplicationHelpers/NetStandardLibraries/InfiniteTracingTester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using NewRelic.Agent.IntegrationTests.Shared.ReflectionHelpers; | ||
using NewRelic.Api.Agent; | ||
|
||
namespace MultiFunctionApplicationHelpers.NetStandardLibraries | ||
{ | ||
[Library] | ||
public class InfiniteTracingTester | ||
{ | ||
[LibraryMethod] | ||
[Transaction] | ||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] | ||
public void Make8TSpan() | ||
{ | ||
var rand = new Random(10); | ||
rand.Next(); | ||
rand.Next(); | ||
rand.Next(); | ||
rand.Next(); | ||
} | ||
|
||
[LibraryMethod] | ||
public static void StartAgent() | ||
{ | ||
NewRelic.Api.Agent.NewRelic.StartAgent(); | ||
//Get everything started up and time for initial Sample(). | ||
Thread.Sleep(TimeSpan.FromSeconds(10)); | ||
} | ||
|
||
[LibraryMethod] | ||
public static void Wait() | ||
{ | ||
Thread.Sleep(TimeSpan.FromSeconds(70)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters