Skip to content

Commit

Permalink
Improve BatchExportActivityProcessorTest.CheckShutdownExport stability (
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Apr 24, 2024
1 parent 98a5d3e commit 51baf9f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void CheckForceFlushExport(int timeout)
[InlineData(Timeout.Infinite)]
[InlineData(0)]
[InlineData(1)]
public void CheckShutdownExport(int timeout)
public void CheckShutdownExport(int timeoutMilliseconds)
{
var exportedItems = new List<Activity>();
using var exporter = new InMemoryExporter<Activity>(exportedItems);
Expand All @@ -134,12 +134,11 @@ public void CheckShutdownExport(int timeout)
};

processor.OnEnd(activity);
processor.Shutdown(timeout);
processor.Shutdown(timeoutMilliseconds);

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

Assert.Single(exportedItems);
Expand Down

0 comments on commit 51baf9f

Please sign in to comment.