-
Notifications
You must be signed in to change notification settings - Fork 55
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
Showing
4 changed files
with
96 additions
and
2 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
73 changes: 73 additions & 0 deletions
73
tests/Agent/IntegrationTests/IntegrationTests/Api/TransactionNameTests.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,73 @@ | ||
// Copyright 2020 New Relic, Inc. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using MultiFunctionApplicationHelpers; | ||
using NewRelic.Agent.IntegrationTestHelpers; | ||
using NewRelic.Agent.IntegrationTestHelpers.Models; | ||
using NewRelic.Testing.Assertions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace NewRelic.Agent.IntegrationTests.Api | ||
{ | ||
public abstract class TransactionNameTests<TFixture> : NewRelicIntegrationTest<TFixture> where TFixture : ConsoleDynamicMethodFixture | ||
{ | ||
protected readonly TFixture Fixture; | ||
|
||
public TransactionNameTests(TFixture fixture, ITestOutputHelper output) : base(fixture) | ||
{ | ||
Fixture = fixture; | ||
Fixture.TestLogger = output; | ||
|
||
Fixture.AddCommand("ApiCalls TestSetTransactionName TestGroup OriginalName,NewName"); | ||
|
||
Fixture.Actions | ||
( | ||
setupConfiguration: () => | ||
{ | ||
var configModifier = new NewRelicConfigModifier(Fixture.DestinationNewRelicConfigFilePath); | ||
configModifier.SetOrDeleteDistributedTraceEnabled(true); | ||
configModifier.SetLogLevel("finest"); | ||
} | ||
); | ||
|
||
Fixture.Initialize(); | ||
} | ||
|
||
[Fact] | ||
public void TestSetTransactionName() | ||
{ | ||
var setNameLines = Fixture.AgentLog.TryGetLogLines(AgentLogBase.TransactionLinePrefix + "Setting transaction name to.*?"); | ||
Assert.Equal(2, setNameLines.Count()); | ||
|
||
Assert.NotNull(Fixture.AgentLog.TryGetTransactionEvent("OtherTransaction/TestGroup/NewName")); | ||
Assert.Null(Fixture.AgentLog.TryGetTransactionEvent("OtherTransaction/TestGroup/OriginalName")); | ||
|
||
// Note the trailing space is necessary here, or we'll find "Ignoring transaction_segment_term with invalid prefix" which is unrelated | ||
var notConnectedLogLine = Fixture.AgentLog.TryGetLogLine(AgentLogBase.TransactionLinePrefix + "Ignoring transaction name "); | ||
Assert.Null(notConnectedLogLine); | ||
|
||
} | ||
} | ||
|
||
[NetFrameworkTest] | ||
public class TransactionNameTestsFW : TransactionNameTests<ConsoleDynamicMethodFixtureFWLatest> | ||
{ | ||
public TransactionNameTestsFW(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output) | ||
: base(fixture, output) | ||
{ | ||
} | ||
} | ||
|
||
[NetCoreTest] | ||
public class TransactionNameTestsCore : TransactionNameTests<ConsoleDynamicMethodFixtureCoreLatest> | ||
{ | ||
public TransactionNameTestsCore(ConsoleDynamicMethodFixtureCoreLatest 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