/
LinuxUnicodeLogFileTest.cs
59 lines (50 loc) · 2.5 KB
/
LinuxUnicodeLogFileTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
using NewRelic.Agent.IntegrationTestHelpers;
using Xunit.Abstractions;
using Xunit;
using NewRelic.Agent.ContainerIntegrationTests.ContainerFixtures;
using System;
namespace ContainerIntegrationTests
{
/// <summary>
/// This test is meant to prevent any regressions from occurring when profiler log lines containing
/// character codes outside of the ascii range are written to log files. Older profiler versions
/// could trigger an error or crash when this happened. Before the profiler change, no transactions
/// would be created by the test application, with the profiler change, the test transaction should be
/// created successfully.
/// </summary>
public class LinuxUnicodeLogFileTest : NewRelicIntegrationTest<DebianX64SmokeTestFixture>
{
private readonly DebianX64SmokeTestFixture _fixture;
public LinuxUnicodeLogFileTest(DebianX64SmokeTestFixture fixture, ITestOutputHelper output) : base(fixture)
{
_fixture = fixture;
_fixture.TestLogger = output;
_fixture.Actions(setupConfiguration: () =>
{
var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
configModifier.ConfigureFasterMetricsHarvestCycle(10);
// The original problem only seemed to occur with some of the finest level log lines
// and it did not occur with console logs.
configModifier.SetLogLevel("finest");
},
exerciseApplication: () =>
{
_fixture.ExerciseApplication();
_fixture.Delay(11); // wait long enough to ensure a metric harvest occurs after we exercise the app
_fixture.AgentLog.WaitForLogLine(AgentLogBase.HarvestFinishedLogLineRegex, TimeSpan.FromSeconds(11));
// shut down the container and wait for the agent log to see it
_fixture.ShutdownRemoteApplication();
_fixture.AgentLog.WaitForLogLine(AgentLogBase.ShutdownLogLineRegex, TimeSpan.FromSeconds(10));
});
_fixture.Initialize();
}
[Fact]
public void Test()
{
var actualMetrics = _fixture.AgentLog.GetMetrics();
Assert.Contains(actualMetrics, m => m.MetricSpec.Name.Equals("WebTransaction/MVC/WeatherForecast/Get"));
}
}
}