bodhi/config/app.cfg | 2 + bodhi/model.py | 11 ++++++---- bodhi/tests/test_controllers.py | 43 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-)
New commits: commit 233806c72ebc19d9eb2a3ce1a8b159dadc814114 Author: Luke Macken lmacken@redhat.com Date: Mon Sep 20 10:38:58 2010 -0400
Add a new unit test to ensure we handle EPEL time-in-testing properly
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py index 5d2276e..0865933 100644 --- a/bodhi/tests/test_controllers.py +++ b/bodhi/tests/test_controllers.py @@ -2590,3 +2590,46 @@ class TestControllers(testutil.DBTest): # Make sure it doesn't obsolete the older one assert PackageUpdate.byTitle(new_params['builds']).status == 'pending' assert PackageUpdate.byTitle(params['builds']).status == 'testing' + + def test_push_EPEL_before_tested(self): + """ + Try pushing an epel package to stable after 13 days in testing, which + will fail, and then try after 14 days. + """ + session = login() + rel = Release(name='EL5', long_name='Fedora EPEL 5', + id_prefix='FEDORA-EPEL', dist_tag='dist-5E-epel') + params = { + 'builds' : 'TurboGears-2.0.9-1.el5', + 'release' : 'Fedora EPEL 5', + 'type_' : 'bugfix', + 'bugs' : '', + 'notes' : '', + 'autokarma': True, + 'stable_karma' : 1, + 'request': 'stable', + 'unstable_karma' : -1, + } + self.save_update(params, session) + update = PackageUpdate.byTitle(params['builds']) + assert update.request == 'testing', update.request + + update.comment('This update has been pushed to testing', author='bodhi') + update.comments[-1].timestamp -= timedelta(days=13) + + assert update.days_in_testing == 13 + + testutil.create_request('/updates/request/stable/%s' % params['builds'], + method='POST', headers=session) + update = PackageUpdate.byTitle(params['builds']) + assert update.request == 'testing', update.request + + update.comments[-2].timestamp -= timedelta(days=1) + assert update.days_in_testing == 14, update.days_in_testing + + testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model']) + testutil.create_request('/updates/request/stable/%s' % params['builds'], + method='POST', headers=session) + log = testutil.get_log() + update = PackageUpdate.byTitle(params['builds']) + assert update.request == 'stable', log
commit f3ee317f77ee5f95aaf7ddffda0dcac6c9646b65 Author: Luke Macken lmacken@redhat.com Date: Mon Sep 20 10:38:38 2010 -0400
When we are calculating the days_in_testing, only take into account bodhi comments
diff --git a/bodhi/model.py b/bodhi/model.py index 12f9679..ded1058 100644 --- a/bodhi/model.py +++ b/bodhi/model.py @@ -1050,7 +1050,8 @@ class PackageUpdate(SQLObject): """ Return the number of days that this update has been in testing """ timestamp = None for comment in self.comments[::-1]: - if comment.text == 'This update has been pushed to testing': + if comment.text == 'This update has been pushed to testing' and \ + comment.author == 'bodhi': timestamp = comment.timestamp if self.status == 'testing': return (datetime.utcnow() - timestamp).days @@ -1059,7 +1060,8 @@ class PackageUpdate(SQLObject): if not timestamp: return for comment in self.comments: - if comment.text == 'This update has been pushed to stable': + if comment.text == 'This update has been pushed to stable' and \ + comment.author == 'bodhi': return (comment.timestamp - timestamp).days return (datetime.utcnow() - timestamp).days
commit 6638991c67d5fa5bdbb9a7c0949350e098d91a5b Author: Luke Macken lmacken@redhat.com Date: Mon Sep 20 10:37:13 2010 -0400
When a request is being processed, not only should we check to see if we have *met* the time-in-testing requirements, but also check if we currently *meet* them.
This allows developers to push their updates to stable even before bodhi's approve_testing_updates job runs.
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg index c7320d6..1a8e8fc 100644 --- a/bodhi/config/app.cfg +++ b/bodhi/config/app.cfg @@ -182,6 +182,8 @@ fedora_epel.mandatory_days_in_testing = 14
testing_approval_msg = "This update has reached %d days in testing and can be pushed to stable now if the maintainer wishes"
+not_yet_tested_msg = 'his update has not yet met the minimum testing requirements defined in the <a href="https://fedoraproject.org/wiki/Package_update_acceptance_criteria">Package Update Acceptance Criteria</a>' + # The number of days worth of updates/comments to display feeds.num_days_to_show = 7 feeds.max_entries = 20 diff --git a/bodhi/model.py b/bodhi/model.py index af8c138..12f9679 100644 --- a/bodhi/model.py +++ b/bodhi/model.py @@ -474,8 +474,9 @@ class PackageUpdate(SQLObject): # If we haven't met the stable karma requirements, check if it has met # the mandatory time-in-testing requirements if self.release.mandatory_days_in_testing: - if not self.met_testing_requirements: - flash_notes = 'This update has not yet met the minimum testing requirements defined in the <a href="https://fedoraproject.org/wiki/Package_update_acceptance_criteria">Package Update Acceptance Criteria</a>' + if not self.met_testing_requirements and \ + not self.meets_testing_requirements: + flash_notes = config.get('not_yet_tested_msg') if self.status == 'testing': self.request = None flash_log(flash_notes)