mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot: fix oversight of logging reason in _skip
When giving a reason of a build skip, the reason paramater was missing in the logging string. Test is also added to verify the build skip.
This commit is contained in:
parent
1617a2e339
commit
41ce858c93
@ -308,7 +308,7 @@ class runbot_build(models.Model):
|
|||||||
def _skip(self, reason=None):
|
def _skip(self, reason=None):
|
||||||
"""Mark builds ids as skipped"""
|
"""Mark builds ids as skipped"""
|
||||||
if reason:
|
if reason:
|
||||||
self._logger('skip', reason)
|
self._logger('skip %s', reason)
|
||||||
self.write({'state': 'done', 'result': 'skipped'})
|
self.write({'state': 'done', 'result': 'skipped'})
|
||||||
to_unduplicate = self.search([('id', 'in', self.ids), ('duplicate_id', '!=', False)])
|
to_unduplicate = self.search([('id', 'in', self.ids), ('duplicate_id', '!=', False)])
|
||||||
to_unduplicate._force()
|
to_unduplicate._force()
|
||||||
|
@ -158,6 +158,29 @@ class Test_Build(common.TransactionCase):
|
|||||||
})
|
})
|
||||||
self.assertEqual(build, self.Build, "build should be an empty recordset")
|
self.assertEqual(build, self.Build, "build should be an empty recordset")
|
||||||
|
|
||||||
|
@patch('odoo.addons.runbot.models.build._logger')
|
||||||
|
def test_build_skip(self, mock_logger):
|
||||||
|
"""test build is skipped"""
|
||||||
|
build = self.Build.create({
|
||||||
|
'branch_id': self.branch.id,
|
||||||
|
'name': 'd0d0caca0000ffffffffffffffffffffffffffff',
|
||||||
|
'port': '1234',
|
||||||
|
})
|
||||||
|
build._skip()
|
||||||
|
self.assertEqual(build.state, 'done')
|
||||||
|
self.assertEqual(build.result, 'skipped')
|
||||||
|
|
||||||
|
other_build = self.Build.create({
|
||||||
|
'branch_id': self.branch.id,
|
||||||
|
'name': 'deadbeef0000ffffffffffffffffffffffffffff',
|
||||||
|
'port': '1234',
|
||||||
|
})
|
||||||
|
other_build._skip(reason='A good reason')
|
||||||
|
self.assertEqual(other_build.state, 'done')
|
||||||
|
self.assertEqual(other_build.result, 'skipped')
|
||||||
|
log_first_part = '%s skip %%s' % (other_build.dest)
|
||||||
|
mock_logger.debug.assert_called_with(log_first_part, 'A good reason')
|
||||||
|
|
||||||
@patch('odoo.addons.runbot.models.branch.runbot_branch._is_on_remote')
|
@patch('odoo.addons.runbot.models.branch.runbot_branch._is_on_remote')
|
||||||
def test_closest_branch_01(self, mock_is_on_remote):
|
def test_closest_branch_01(self, mock_is_on_remote):
|
||||||
""" test find a matching branch in a target repo based on branch name """
|
""" test find a matching branch in a target repo based on branch name """
|
||||||
|
Loading…
Reference in New Issue
Block a user