mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot_merge: the fix
The test was checking things would work properly with required_statuses being an empty string, because I'd also forgotten an empty field becomes stored as `False` in the database, so trying things out live neither the PRs nor the staging would work as their assumption that they could straight split the required_statuses would always fail. Update the test to better match expectations, and hopefully this is the end of that saga.
This commit is contained in:
parent
4bdf7e5eda
commit
0831c899e8
@ -893,7 +893,7 @@ class PullRequests(models.Model):
|
||||
# targets
|
||||
failed = self.browse(())
|
||||
for pr in self:
|
||||
required = filter(None, pr.repository.required_statuses.split(','))
|
||||
required = filter(None, (pr.repository.required_statuses or '').split(','))
|
||||
|
||||
success = True
|
||||
for ci in required:
|
||||
@ -1477,6 +1477,7 @@ class Stagings(models.Model):
|
||||
(head, repos[repo].required_statuses.split(','))
|
||||
for repo, head in json.loads(s.heads).items()
|
||||
if not repo.endswith('^')
|
||||
if repos[repo].required_statuses
|
||||
]
|
||||
# maps commits to their statuses
|
||||
cmap = {
|
||||
@ -1488,7 +1489,7 @@ class Stagings(models.Model):
|
||||
st = 'success'
|
||||
for head, reqs in required_statuses:
|
||||
statuses = cmap.get(head) or {}
|
||||
for v in map(lambda n: state_(statuses, n), filter(None, reqs)):
|
||||
for v in map(lambda n: state_(statuses, n), reqs):
|
||||
if st == 'failure' or v in ('error', 'failure'):
|
||||
st = 'failure'
|
||||
elif v is None:
|
||||
|
@ -940,7 +940,7 @@ def test_reopen_state(env, repo):
|
||||
def test_no_required_statuses(env, repo, config):
|
||||
""" check that mergebot can work on a repo with no CI at all
|
||||
"""
|
||||
env['runbot_merge.repository'].search([('name', '=', repo.name)]).required_statuses = ''
|
||||
env['runbot_merge.repository'].search([('name', '=', repo.name)]).required_statuses = False
|
||||
with repo:
|
||||
m = repo.make_commit(None, 'initial', None, tree={'0': '0'})
|
||||
repo.make_ref('heads/master', m)
|
||||
|
Loading…
Reference in New Issue
Block a user