Skip to content

Commit 51baf9f

Browse files
authored
Improve BatchExportActivityProcessorTest.CheckShutdownExport stability (#5567)
1 parent 98a5d3e commit 51baf9f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/OpenTelemetry.Tests/Trace/BatchExportActivityProcessorTest.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void CheckForceFlushExport(int timeout)
118118
[InlineData(Timeout.Infinite)]
119119
[InlineData(0)]
120120
[InlineData(1)]
121-
public void CheckShutdownExport(int timeout)
121+
public void CheckShutdownExport(int timeoutMilliseconds)
122122
{
123123
var exportedItems = new List<Activity>();
124124
using var exporter = new InMemoryExporter<Activity>(exportedItems);
@@ -134,12 +134,11 @@ public void CheckShutdownExport(int timeout)
134134
};
135135

136136
processor.OnEnd(activity);
137-
processor.Shutdown(timeout);
137+
processor.Shutdown(timeoutMilliseconds);
138138

139-
if (timeout == 0)
139+
if (timeoutMilliseconds < 1_000)
140140
{
141-
// Shutdown(0) will trigger flush and return immediately, so let's sleep for a while
142-
Thread.Sleep(1_000);
141+
Thread.Sleep(1_000 - timeoutMilliseconds);
143142
}
144143

145144
Assert.Single(exportedItems);

0 commit comments

Comments
 (0)