Accept requests that are only stuck in Factory staging

If only the review by a factory staging project is left in state new and
all others are in state accepted it means legal, opensuse-review team
etc have completed. So it's safe to consider such a request accepted for
inclusion into Factory. So let's not waste time waiting for the next
Factory checkin round.
This commit is contained in:
Ludwig Nussel 2016-08-19 10:17:06 +02:00
parent c39900f861
commit 9c4382c1a9
2 changed files with 16 additions and 1 deletions

View File

@ -148,7 +148,17 @@ class FactorySourceChecker(ReviewBot.ReviewBot):
return True
elif req.state.name == 'review':
self.logger.info("request still in review")
return None
if not req.reviews:
self.logger.error("request in state review but no reviews?")
return False
for r in req.reviews:
if r.by_project and r.state == 'new' and r.by_project.startswith('openSUSE:Factory:Staging:'):
self.logger.info("%s review by %s ok", r.state, r.by_project)
continue
if r.state != 'accepted':
self.logger.debug("review %s/%s/%s in state %s", r.by_user, r.by_group, r.by_package, r.state)
return None
return True
else:
self.logger.error("request in state %s not expected"%req.state.name)
return None

View File

@ -124,6 +124,9 @@ class TestFactorySourceAccept(unittest.TestCase):
<state name="review" who="factory-auto" when="2014-10-08T11:55:56">
<comment>...</comment>
</state>
<review state="new" by_group="opensuse-review-team">
<comment/>
</review>
<description> ... </description>
</request>
</collection>
@ -150,6 +153,8 @@ class TestFactorySourceAccept(unittest.TestCase):
u = urlparse.urlparse(uri)
if u.query == 'newstate=accepted&cmd=changereviewstate&by_user=factory-source':
result['status'] = True
else:
result['status'] = 'ERROR'
return (200, headers, '<status code="blah"/>')
httpretty.register_uri(httpretty.POST,