Re-enable TestScheduler.test_rerun_on_error

This test is making sure that when something terrible goes wrong in the
launcher and it just returns 'None', the scheduler retries.

During refactoring of the launcher, some of the logic that handled this
special case of run_error was removed. Also the launcher wasn't properly
handling a return of None and would have failed with a TypeError instead
of sending a failure to the zuul client.

Change-Id: I6b063ba913bf72087d2cc027f08e02304310c2be
Story: 2000773
Task: 3403
This commit is contained in:
Clint Byrum 2016-12-02 16:40:35 -08:00
parent 2e7f9d7057
commit 69e4712574
3 changed files with 5 additions and 1 deletions

View File

@ -758,6 +758,8 @@ class RecordingLaunchServer(zuul.launcher.server.LaunchServer):
self.running_builds.remove(build)
del self.job_builds[job.unique]
self.lock.release()
if build.run_error:
result = None
return result

View File

@ -2104,7 +2104,6 @@ class TestScheduler(ZuulTestCase):
self.assertEqual(D.data['status'], 'MERGED')
self.assertEqual(D.reported, 2)
@skip("Disabled for early v3 development")
def test_rerun_on_error(self):
"Test that if a worker fails to run a job, it is run again"
self.launch_server.hold_jobs_in_build = True

View File

@ -380,6 +380,9 @@ class LaunchServer(object):
job.sendWorkStatus(0, 100)
result = self.runAnsible(jobdir, job)
if result is None:
job.sendWorkFail()
return
result = dict(result=result)
job.sendWorkComplete(json.dumps(result))