Skip to content

Commit 006eeae

Browse files
committed
Fix flaky contention test
1 parent eeed53a commit 006eeae

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

profiler/test/Datadog.Profiler.IntegrationTests/Contention/ContentionProfilerTest.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,22 @@ public void ShouldContentionProfilerBeEnabledByDefault(string appName, string fr
8989
{
9090
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: ScenarioContention);
9191

92-
// disable default profilers except contention
92+
// disabled all default profiles except contention and wall time
93+
// thread lifetime profiler enabled <= this one will help us gathering
94+
// an accurate view on the threads that are alive during the profiling
9395
runner.Environment.SetVariable(EnvironmentVariables.WallTimeProfilerEnabled, "0");
9496
runner.Environment.SetVariable(EnvironmentVariables.CpuProfilerEnabled, "0");
9597
runner.Environment.SetVariable(EnvironmentVariables.GarbageCollectionProfilerEnabled, "0");
9698
runner.Environment.SetVariable(EnvironmentVariables.ExceptionProfilerEnabled, "0");
9799
runner.Environment.SetVariable(EnvironmentVariables.GcThreadsCpuTimeEnabled, "0");
98-
runner.Environment.SetVariable(EnvironmentVariables.ThreadLifetimeEnabled, "0");
100+
runner.Environment.SetVariable(EnvironmentVariables.ThreadLifetimeEnabled, "1");
99101

100102
using var agent = MockDatadogAgent.CreateHttpAgent(runner.XUnitLogger);
101103

102104
runner.Run(agent);
103105

104-
// only contention profiler enabled so should see 2 value per sample
105-
SamplesHelper.CheckSamplesValueCount(runner.Environment.PprofDir, 2);
106+
// only contention profiler enabled so should see 3 value per sample
107+
SamplesHelper.CheckSamplesValueCount(runner.Environment.PprofDir, 3);
106108
Assert.NotEqual(0, SamplesHelper.GetSamplesCount(runner.Environment.PprofDir));
107109

108110
if (framework == "net8.0")

0 commit comments

Comments
 (0)