Skip to content

Commit

Permalink
ci: Adjust metric harvest cycle and introduce a delay for linux smoke…
Browse files Browse the repository at this point in the history
… tests. (#1945)
  • Loading branch information
tippmar-nr authored Oct 4, 2023
1 parent 9c7e114 commit e3f12cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e3f12cd

Please sign in to comment.