summaryrefslogtreecommitdiff
blob: 1d6c654f631e0318027ab0cbb2fb26dab0f2de3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From f324dd5fc477888517db7b431bc291d0712969af Mon Sep 17 00:00:00 2001
From: Eduardo de Souza Cruz <eduardo.cruz@kdemail.net>
Date: Mon, 14 Mar 2022 14:12:17 -0300
Subject: [PATCH] Remove upper-limits for RunnerManagerTest's timeouts

Those upper-limits timeouts were not conservative enough for the Continuous Integration environment which can be slow and this test was failing sometimes.

The upper-limits timing verifications were removed without too much prejudice to the overall test. It should still serve its purpose to guarantee there will be no regression on this functionality.
---
 autotests/runnermanagertest.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/autotests/runnermanagertest.cpp b/autotests/runnermanagertest.cpp
index 02c0985..82bd2a4 100644
--- a/autotests/runnermanagertest.cpp
+++ b/autotests/runnermanagertest.cpp
@@ -74,8 +74,9 @@ private Q_SLOTS:
         // However not yet a matcheschanged, it should be stalled for 250ms
         QCOMPARE(spyMatchesChanged.count(), 0);
 
-        // After 250ms it will emit with empty matches, we wait for that
-        QVERIFY(spyMatchesChanged.wait(265)); // 265ms as a margin of safety for 250ms
+        // After 250ms it will emit with empty matches, we wait for that.
+        // We can't put a low upper limit on these wait() calls because the CI environment can be slow.
+        QVERIFY(spyMatchesChanged.wait()); // This should take just a tad longer than 250ms.
 
         // This should have taken no less than 250ms. It waits for 250s before "giving up" and emitting an empty matches list.
         QVERIFY(timer.elapsed() >= 250);
@@ -84,20 +85,18 @@ private Q_SLOTS:
         QCOMPARE(spyQueryFinished.count(), 1); // Still the same, query is not done
 
         // We programmed it to emit the result after 300ms, so we need to wait 50ms more for the next emission
-        QVERIFY(spyQueryFinished.wait(100)); // 100ms as a margin of safety for 50ms
+        QVERIFY(spyQueryFinished.wait());
 
         // This should have taken at least 300ms total, as we requested via the special query string
         QVERIFY(timer.elapsed() >= 300);
 
-        // RunnerManager::jobDone() should have anticipated the final emission, so it should not have waited the full 250+250 ms.
-        QVERIFY(timer.elapsed() <= 330); // This total should be just a tad bigger than 300ms, we put a 10% margin of safety
-
+        // At this point RunnerManager::jobDone() should have anticipated the final emission.
         QCOMPARE(spyMatchesChanged.count(), 2); // We had the second matchesChanged emission, now with the query result
         QCOMPARE(manager->matches().count(), 1); // The result is here
         QCOMPARE(spyQueryFinished.count(), 2); // Will have emited queryFinished, job is done
 
         // Now we will make sure that RunnerManager::scheduleMatchesChanged() emits matchesChanged instantly
-        // if we start a query with an empty string. It will never produce results, stalling is meaninless
+        // if we start a query with an empty string. It will never produce results, stalling is meaningless
         manager->launchQuery("");
         QCOMPARE(spyMatchesChanged.count(), 3); // One more, instantly, without stall
         QCOMPARE(manager->matches().count(), 0); // Empty results for empty query string
-- 
GitLab