From fe49650ac63ffbb1b4d8c12597b245ae6dbe484c Mon Sep 17 00:00:00 2001 From: Adrian Hall Date: Mon, 19 Aug 2024 11:24:12 -0700 Subject: [PATCH] fix: timing error in tests (#70) --- .../Threading/QueueHandler_Tests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CommunityToolkit.Datasync.Client.Test/Threading/QueueHandler_Tests.cs b/tests/CommunityToolkit.Datasync.Client.Test/Threading/QueueHandler_Tests.cs index 75d070c..b38d04a 100644 --- a/tests/CommunityToolkit.Datasync.Client.Test/Threading/QueueHandler_Tests.cs +++ b/tests/CommunityToolkit.Datasync.Client.Test/Threading/QueueHandler_Tests.cs @@ -47,7 +47,9 @@ public async Task QueueHandler_WithThreads_Enqueue(int nThreads) accId.Should().HaveCount(nElements); accTh.Should().HaveCount(nElements); accTh.AsEnumerable().Distinct().Should().HaveCount(nThreads); - (endTime - startTime).TotalSeconds.Should().BeLessThanOrEqualTo((nElements / nThreads) + 2); + // This just makes sure that the amount of time is "of the right order of magnitude" since CI systems + // are notoriously bad at correct timings. We just don't want it to be 10x the expected time. + (endTime - startTime).TotalSeconds.Should().BeLessThanOrEqualTo((nElements / nThreads) + 5); } [Theory(Timeout = 30000)]