Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
445f7c2
commit 11c0241
Showing
7 changed files
with
145 additions
and
11 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
19 changes: 19 additions & 0 deletions
19
...tionTests/Applications/ConsoleInstrumentationStartup/ConsoleInstrumentationStartup.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\SharedApplications\Common\SharedApplicationHelpers\SharedApplicationHelpers.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
tests/Agent/IntegrationTests/Applications/ConsoleInstrumentationStartup/Program.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,26 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using NewRelic.Api.Agent; | ||
|
||
namespace ConsoleInstrumentationStartup; | ||
|
||
static class Program | ||
{ | ||
[Transaction] | ||
static void Main() | ||
{ | ||
Console.WriteLine($"{DateTime.Now} Main enter"); | ||
|
||
var stopWatch = new Stopwatch(); | ||
stopWatch.Start(); | ||
|
||
NewRelic.Api.Agent.NewRelic.SetTransactionName("category", "name"); | ||
|
||
stopWatch.Stop(); | ||
|
||
Console.WriteLine($"{DateTime.Now} Main exit"); | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
...nt/IntegrationTests/IntegrationTests/AgentFeatures/InstrumentationStartupDeadlockTests.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,56 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Linq; | ||
using NewRelic.Agent.IntegrationTestHelpers; | ||
using NewRelic.Testing.Assertions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace NewRelic.Agent.IntegrationTests.AgentFeatures | ||
{ | ||
/// <summary> | ||
/// Tests that the agent doesn't deadlock at startup | ||
/// </summary> | ||
[NetCoreTest] | ||
public class InstrumentationStartupDeadlockTests : NewRelicIntegrationTest<RemoteServiceFixtures.ConsoleInstrumentationStartupFixtureCore> | ||
{ | ||
private readonly RemoteServiceFixtures.ConsoleInstrumentationStartupFixtureCore _fixture; | ||
|
||
public InstrumentationStartupDeadlockTests(RemoteServiceFixtures.ConsoleInstrumentationStartupFixtureCore fixture, ITestOutputHelper output) : base(fixture) | ||
{ | ||
_fixture = fixture; | ||
_fixture.TestLogger = output; | ||
|
||
_fixture.Actions | ||
( | ||
setupConfiguration: () => | ||
{ | ||
var configPath = fixture.DestinationNewRelicConfigFilePath; | ||
var configModifier = new NewRelicConfigModifier(configPath); | ||
configModifier.SetHostPort(9999); // use a bogus port to generate an exception during HttpClient.SendAsync() on connect | ||
configModifier.SetSendDataOnExit(); | ||
configModifier.ForceTransactionTraces(); | ||
configModifier.SetLogLevel("finest"); | ||
configModifier.DisableEventListenerSamplers(); // Required for .NET 8 to pass. | ||
}, | ||
exerciseApplication: () => | ||
{ | ||
} | ||
); | ||
|
||
_fixture.Initialize(); | ||
} | ||
|
||
[Fact] | ||
public void Test() | ||
{ | ||
var expectedLogLineRegexes = new[] { AgentLogBase.ShutdownLogLineRegex }; | ||
|
||
Assertions.LogLinesExist(expectedLogLineRegexes, _fixture.AgentLog.GetFileLines()); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ationTests/IntegrationTests/RemoteServiceFixtures/ConsoleInstrumentationStartupFixture.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,25 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
using NewRelic.Agent.IntegrationTestHelpers.RemoteServiceFixtures; | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace NewRelic.Agent.IntegrationTests.RemoteServiceFixtures | ||
{ | ||
public class ConsoleInstrumentationStartupFixtureCore : RemoteApplicationFixture | ||
{ | ||
private static readonly string ApplicationDirectoryName = @"ConsoleInstrumentationStartup"; | ||
private static readonly string ExecutableName = $"{ApplicationDirectoryName}.exe"; | ||
|
||
public ConsoleInstrumentationStartupFixtureCore() | ||
: base(new RemoteConsoleApplication(ApplicationDirectoryName, ExecutableName, ApplicationType.Bounded, true, true) | ||
.SetTimeout(TimeSpan.FromMinutes(2))) | ||
{ | ||
|
||
} | ||
|
||
} | ||
} |