Skip to content

Commit

Permalink
don't let errors in nextBuild silently prevent any build from starting
Browse files Browse the repository at this point in the history
  • Loading branch information
Buck Golemon committed Aug 7, 2013
1 parent 3118974 commit c59cbbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions master/buildbot/process/buildrequestdistributor.py
Expand Up @@ -262,6 +262,8 @@ def _getNextUnclaimedBuildRequest(self):
if nextBreq not in breqs:
nextBreq = None
except Exception:
log.err(Failure(),
"from _getNextUnclaimedBuildRequest for builder '%s'" % (self.bldr,))
nextBreq = None
else:
# otherwise just return the first build
Expand Down
Expand Up @@ -740,6 +740,7 @@ def test_nextBuild_bogus(self):
yield self.do_test_maybeStartBuildsOnBuilder(rows=rows,
exp_claims=[], exp_builds=[])

@compat.usesFlushLoggedErrors
@defer.inlineCallbacks
def test_nextBuild_fails(self):
def nextBuildRaises(*args):
Expand All @@ -749,8 +750,10 @@ def nextBuildRaises(*args):
rows = self.base_rows + [
fakedb.BuildRequest(id=11, buildsetid=11, buildername="A"),
]
yield self.do_test_maybeStartBuildsOnBuilder(rows=rows,
result = self.do_test_maybeStartBuildsOnBuilder(rows=rows,
exp_claims=[], exp_builds=[])
self.assertEqual(1, len(self.flushLoggedErrors(RuntimeError)))
yield result


# check concurrency edge cases
Expand Down Expand Up @@ -872,15 +875,22 @@ def nextBuild(bldr, lst):
return defer.succeed(lst[-1])
return self.do_test_nextBuild(nextBuild, exp_choice=[13, 12, 11, 10])

@compat.usesFlushLoggedErrors
def test_nextBuild_exception(self):
def nextBuild(bldr, lst):
raise RuntimeError("")
return self.do_test_nextBuild(nextBuild)
result = self.do_test_nextBuild(nextBuild)
self.assertEqual(1, len(self.flushLoggedErrors(RuntimeError)))
return result


@compat.usesFlushLoggedErrors
def test_nextBuild_failure(self):
def nextBuild(bldr, lst):
return defer.fail(failure.Failure(RuntimeError()))
return self.do_test_nextBuild(nextBuild)
result = self.do_test_nextBuild(nextBuild)
self.assertEqual(1, len(self.flushLoggedErrors(RuntimeError)))
return result


# merge tests
Expand Down

0 comments on commit c59cbbf

Please sign in to comment.