Skip to content

Commit

Permalink
Fix race condition in TypicalLoop_WithLogsQueueTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse committed Jan 8, 2025
1 parent c0655f6 commit 0e0de0e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="TelemetryControllerSchedulerTests.cs" company="Datadog">
// <copyright file="TelemetryControllerSchedulerTests.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>
Expand Down Expand Up @@ -162,6 +162,8 @@ public async Task TypicalLoop_WithLogsQueueTrigger()
delayMutex.Wait();
queueTcs.SetResult(true); // this triggers the queue task

await waitTask;

// t = 15s;
_scheduler.ShouldFlushTelemetry.Should().BeFalse(); // not a complete interval
_scheduler.ShouldFlushRedactedErrorLogs.Should().BeTrue(); // triggered by queue
Expand All @@ -180,7 +182,7 @@ public async Task TypicalLoop_WithLogsQueueTrigger()
// t = 125s;
_scheduler.ShouldFlushTelemetry.Should().BeTrue();
_scheduler.ShouldFlushRedactedErrorLogs.Should().BeTrue();
}
}

[Fact]
public async Task DoesNotFlushTelemetryUntilInitialized()
Expand Down

0 comments on commit 0e0de0e

Please sign in to comment.