From 967528d3ae50617075fbdc739fb5702b752742fe Mon Sep 17 00:00:00 2001 From: Krzysztof Nozderko Date: Fri, 17 May 2024 12:54:13 +0200 Subject: [PATCH] Fix pool flaky test (#950) ### Description Fix pool flaky test. ### Checklist - [x] Code compiles correctly - [x] Code is formatted according to [Coding Conventions](../blob/master/CodingConventions.md) - [x] Created tests which fail without the change (if possible) - [x] All tests passing (`dotnet test`) - [x] Extended the README / documentation, if necessary - [ ] Provide JIRA issue id (if possible) or GitHub issue id in PR name --- .../IntegrationTests/ConnectionMultiplePoolsIT.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs index 201e50ca8..4b7ec61f0 100644 --- a/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsIT.cs @@ -195,6 +195,7 @@ public void TestWaitInAQueueForAnIdleSession() const long CMaxConnectDuration = AMaxConnectionReleaseTime - CDelay; // 3650 - 800 = 2850 const long DMinConnectDuration = BMinConnectionReleaseTime - DDelay - StartDelayPessimisticEstimate; // 2400 - 1200 - 350 = 850 const long DMaxConnectDuration = BMaxConnectionReleaseTime - DDelay; // 3650 - 800 = 2850 + const long MeasurementTolerance = 25; var threads = new ConnectingThreads(connectionString) .NewThread("A", ADelay, ABDelayAfterConnect, true) @@ -223,8 +224,8 @@ public void TestWaitInAQueueForAnIdleSession() // first to wait from C and D should first to connect, because we won't create a new session, we just reuse sessions returned by A and B threads Assert.AreEqual(waitingEvents[0].ThreadName, lastConnectingEventsGroup[0].ThreadName); Assert.AreEqual(waitingEvents[1].ThreadName, lastConnectingEventsGroup[1].ThreadName); - Assert.That(lastConnectingEventsGroup[0].Duration, Is.InRange(CMinConnectDuration, CMaxConnectDuration)); - Assert.That(lastConnectingEventsGroup[1].Duration, Is.InRange(DMinConnectDuration, DMaxConnectDuration)); + Assert.That(lastConnectingEventsGroup[0].Duration, Is.InRange(CMinConnectDuration - MeasurementTolerance, CMaxConnectDuration)); + Assert.That(lastConnectingEventsGroup[1].Duration, Is.InRange(DMinConnectDuration - MeasurementTolerance, DMaxConnectDuration)); } [Test]