Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Improve integration test reliability #1825

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public virtual void Initialize()
}
catch (Exception ex)
{
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
retryTest = true;
TestLogger?.WriteLine("Exception occurred in try number " + (numberOfTries + 1) + " : " + ex.ToString());
retryMessage = "Exception thrown.";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class Timing
{
public static readonly TimeSpan TimeToColdStart = TimeSpan.FromMinutes(5);
public static readonly TimeSpan TimeToConnect = TimeSpan.FromSeconds(30);
public static readonly TimeSpan TimeToWaitForLog = TimeSpan.FromMinutes(1);
public static readonly TimeSpan TimeToWaitForLog = TimeSpan.FromMinutes(3);
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
public static readonly TimeSpan TimeToApm = TimeSpan.FromMinutes(7);
public static readonly TimeSpan TimeBetweenHarvests = TimeSpan.FromMinutes(1);
public static readonly TimeSpan ApmCheckInterval = TimeSpan.FromSeconds(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public void Test()
NrAssert.Multiple(
() => Assert.Contains(@"""OTHER"":[[[""Native"",""Function Call"",0]", _threadProfileString),
() => Assert.Contains(@"[""HostedWebCore.Program"",""Main"",0]", _threadProfileString),
() => Assert.Contains(@"System.Threading", _threadProfileString),
() => Assert.Contains(@"System.Web", _threadProfileString)
() => Assert.Contains(@"System.Threading", _threadProfileString)
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public InfiniteTracingTestsBase(TFixture fixture, ITestOutputHelper output) : ba
_fixture.SendCommand("InfiniteTracingTester Make8TSpan");
// Now wait to see that the 8T spans were sent successfully
_fixture.AgentLog.WaitForLogLinesCapturedIntCount(AgentLogBase.SpanStreamingSuccessfullySentLogLineRegex, TimeSpan.FromMinutes(1), ExpectedSentCount);
_fixture.AgentLog.WaitForLogLinesCapturedIntCount(AgentLogBase.SpanStreamingSuccessfullyProcessedByServerResponseLogLineRegex, TimeSpan.FromMinutes(1), ExpectedSentCount);
}
chynesNR marked this conversation as resolved.
Show resolved Hide resolved

);
Expand All @@ -57,13 +56,11 @@ public void Test()
{
//1 span count for the Make8TSpan method, another span count for the root span.
var expectedSeenCount = 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ public void Test()

var generalMetrics = new List<Assertions.ExpectedMetric>
{
new Assertions.ExpectedMetric { metricName = @"Supportability/AnalyticsEvents/TotalEventsSeen", callCount = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"Supportability/AnalyticsEvents/TotalEventsSeen", CallCountAllHarvests = ExpectedTransactionCount },
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
new Assertions.ExpectedMetric { metricName = @"Supportability/AnalyticsEvents/TotalEventsCollected", callCount = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"Apdex"},
new Assertions.ExpectedMetric { metricName = @"ApdexAll"},
new Assertions.ExpectedMetric { metricName = @"HttpDispatcher", callCount = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"WebTransaction", callCount = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"HttpDispatcher", CallCountAllHarvests = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"WebTransaction", CallCountAllHarvests = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"WebTransactionTotalTime", callCount = ExpectedTransactionCount },

new Assertions.ExpectedMetric { metricName = @"DotNet/Owin Middleware Pipeline", callCount = ExpectedTransactionCount },
new Assertions.ExpectedMetric { metricName = @"DotNet/Owin Middleware Pipeline", CallCountAllHarvests = ExpectedTransactionCount },
};

var ioBoundNoSpecialAsyncMetrics = new List<Assertions.ExpectedMetric> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public void Test()

var expectedMetrics = new List<Assertions.ExpectedMetric>
{
new Assertions.ExpectedMetric {metricName = @"DotNet/Owin Middleware Pipeline", callCount = expectedCallCount},
new Assertions.ExpectedMetric {metricName = @"WebTransaction", callCount = expectedCallCount},
new Assertions.ExpectedMetric {metricName = @"WebTransaction/StatusCode/404", callCount = expectedCallCount},
new Assertions.ExpectedMetric {metricName = @"DotNet/Owin Middleware Pipeline", CallCountAllHarvests = expectedCallCount},
new Assertions.ExpectedMetric {metricName = @"WebTransaction", CallCountAllHarvests = expectedCallCount},
new Assertions.ExpectedMetric {metricName = @"WebTransaction/StatusCode/404", CallCountAllHarvests = expectedCallCount},
};
var unexpectedMetrics = new List<Assertions.ExpectedMetric>();
foreach (var bogusPath in bogusPaths)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ private void WriteApplicationAgentLogToTestLogger(string applicationName, Remote
public override void ShutdownRemoteApplication()
{
FirstCallApplication.Shutdown();
FirstCallApplication.WaitForExit();
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
FirstCallApplication.CapturedOutput?.WriteProcessOutputToLog($"{nameof(FirstCallApplication)} application:");

SecondCallApplication.Shutdown();
SecondCallApplication.WaitForExit();
SecondCallApplication.CapturedOutput?.WriteProcessOutputToLog($"{nameof(SecondCallApplication)} application:");

base.ShutdownRemoteApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public void BulkCreatingItemsTests()
new Assertions.ExpectedMetric { metricName = $"Datastore/operation/CosmosDB/ReadDatabase", metricScope = expectedTransactionName, callCount = 1 },
new Assertions.ExpectedMetric { metricName = $"Datastore/operation/CosmosDB/DeleteDatabase", metricScope = expectedTransactionName, callCount = 1 },
new Assertions.ExpectedMetric { metricName = $"Datastore/operation/CosmosDB/CreateCollection", metricScope = expectedTransactionName, callCount = 1 },
new Assertions.ExpectedMetric { metricName = $"Datastore/statement/CosmosDB/{_testContainerName}/BatchDocument", metricScope = expectedTransactionName, callCount = 1 }
chynesNR marked this conversation as resolved.
Show resolved Hide resolved
};

var metrics = _fixture.AgentLog.GetMetrics().ToList();
Expand Down
Loading