From 29437e34b6798f5008d0a7548677f8ae0b129731 Mon Sep 17 00:00:00 2001 From: Marty Tippin <120425148+tippmar-nr@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:42:00 -0500 Subject: [PATCH] ci: Adjust metric harvest cycle and introduce a delay for linux smoke tests. --- .../ContainerFixtures/LinuxSmokeTestFixtures.cs | 7 +++++++ .../ContainerIntegrationTests/LinuxSmokeTests.cs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs b/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs index 06f49d9cac..d8e2aef9c3 100644 --- a/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs +++ b/tests/Agent/IntegrationTests/ContainerIntegrationTests/ContainerFixtures/LinuxSmokeTestFixtures.cs @@ -1,6 +1,8 @@ // Copyright 2020 New Relic, Inc. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +using System; +using System.Threading.Tasks; using Xunit; namespace NewRelic.Agent.ContainerIntegrationTests.ContainerFixtures; @@ -19,6 +21,11 @@ public virtual void ExerciseApplication() var address = $"http://localhost:{Port}/weatherforecast"; GetAndAssertStatusCode(address, System.Net.HttpStatusCode.OK); } + + public void Delay(int seconds) + { + Task.Delay(TimeSpan.FromSeconds(seconds)).GetAwaiter().GetResult(); + } } public class DebianX64SmokeTestFixture : LinuxSmokeTestFixtureBase diff --git a/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs b/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs index dd1e564b0d..606be501f7 100644 --- a/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs +++ b/tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxSmokeTests.cs @@ -21,14 +21,15 @@ protected LinuxSmokeTest(T fixture, ITestOutputHelper output) : base(fixture) _fixture.Actions(setupConfiguration: () => { var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath); - configModifier.ConfigureFasterMetricsHarvestCycle(5); + configModifier.ConfigureFasterMetricsHarvestCycle(10); configModifier.LogToConsole(); }, exerciseApplication: () => { _fixture.ExerciseApplication(); - _fixture.AgentLog.WaitForLogLine(AgentLogBase.HarvestFinishedLogLineRegex, TimeSpan.FromSeconds(10)); + _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();