Explorar el Código

[jobbrowser] Fix flakey test

Wait for the job in 'test_kill_job' to actually be killed.
This can take a few seconds from experience.
abec hace 13 años
padre
commit
0316b2d
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      apps/jobbrowser/src/jobbrowser/tests.py

+ 9 - 2
apps/jobbrowser/src/jobbrowser/tests.py

@@ -238,11 +238,18 @@ class TestJobBrowserWithHadoop(unittest.TestCase, OozieServerProvider):
     # Kill task
     self.client.post('/jobbrowser/jobs/%s/kill' % (hadoop_job_id,))
 
-    # It should say killed
+    # It should say killed at some point
     response = self.client.get('/jobbrowser/jobs/%s' % (hadoop_job_id,))
     html = response.content.lower()
+    i = 0
+    while 'killed' not in html and i < 10:
+      time.sleep(5)
+      response = self.client.get('/jobbrowser/jobs/%s' % (hadoop_job_id,))
+      html = response.content.lower()
+      i += 1
+
     assert_true(views.get_shorter_id(hadoop_job_id) in html)
-    assert_true('killed' in html)
+    assert_true('killed' in html, html)
 
     # Exercise select by taskstate
     self.client.get('/jobbrowser/jobs/%s/tasks?taskstate=failed' % (hadoop_job_id,))