In tests, give Ganeti enough time to actually start up jobs before
asserting that they succeed. While normally forking and executing
a job is finished in less than a second in some circumstances it
can take longer; so give enough time to avoid flaky tests.

While there, also pause the watcher, so that it doesn't submit
jobs inbetween that cause our 0.01 second delay jobs to take
longer while waiting for locks taken by the watcher's jobs.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 qa/qa_filters.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qa/qa_filters.py b/qa/qa_filters.py
index 3eaa7e7..624f107 100644
--- a/qa/qa_filters.py
+++ b/qa/qa_filters.py
@@ -277,6 +277,8 @@ def TestFilterAcceptPause():
   and that the ACCEPT filter immediately allows starting.
   """
 
+  AssertCommand(["gnt-cluster", "watcher", "pause", "600"])
+
   # Add a filter chain that pauses all new jobs apart from those with a
   # specific reason.
   # When the pausing filter is deleted, paused jobs must be continued.
@@ -310,7 +312,7 @@ def TestFilterAcceptPause():
     "0.01",
   ]))
 
-  time.sleep(0.5)  # give some time to get queued
+  time.sleep(5)  # give some time to get queued
 
   AssertStatusRetry(jid1, "queued")  # job should be paused
   AssertStatusRetry(jid2, "success")  # job should not be paused
@@ -320,8 +322,11 @@ def TestFilterAcceptPause():
   AssertCommand(["gnt-filter", "delete", uuid2])
 
   # Now the paused job should run through.
+  time.sleep(5)
   AssertStatusRetry(jid1, "success")
 
+  AssertCommand(["gnt-cluster", "watcher", "continue"])
+
 
 def TestFilterRateLimit():
   """Tests that the RATE_LIMIT filter does reject new jobs when all
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to