Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage single build update conflicting builds. #3829

Merged
merged 2 commits into from Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions bodhi/server/scripts/approve_testing.py
Expand Up @@ -128,9 +128,15 @@ def main(argv=sys.argv):
f"These builds {builds_str} have a more recent "
f"build in koji's {update.release.stable_tag} tag.",
author="bodhi")
update.status = UpdateStatus.pending
update.request = None
update.remove_tag(update.release.get_testing_side_tag(update.from_tag))
if update.from_tag is not None:
update.status = UpdateStatus.pending
update.remove_tag(
update.release.get_testing_side_tag(update.from_tag))
else:
update.status = UpdateStatus.obsolete
update.remove_tag(update.release.pending_testing_tag)
update.remove_tag(update.release.candidate_tag)
db.commit()
continue

Expand Down
10 changes: 7 additions & 3 deletions bodhi/tests/server/scripts/test_approve_testing.py
Expand Up @@ -919,7 +919,11 @@ def test_autotime_update_no_autokarma_negative_karma_not_pushed(self):

@patch("bodhi.server.buildsys.DevBuildsys.getLatestBuilds", return_value=[{
'creation_time': '2007-08-25 19:38:29.422344'}])
def test_update_conflicting_build_not_pushed(self, build_creation_time):
@pytest.mark.parametrize(('from_tag', 'update_status'),
[('f17-build-side-1234', models.UpdateStatus.pending),
(None, models.UpdateStatus.obsolete)])
def test_update_conflicting_build_not_pushed(self, build_creation_time,
from_tag, update_status):
"""
Ensure that an update that have conflicting builds will not get pushed.
"""
Expand All @@ -932,7 +936,7 @@ def test_update_conflicting_build_not_pushed(self, build_creation_time):
update.date_testing = datetime.utcnow() - timedelta(days=8)
update.status = models.UpdateStatus.testing
update.release.composed_by_bodhi = False
update.from_tag = 'f17-build-side-1234'
update.from_tag = from_tag

# Clear pending messages
self.db.info['messages'] = []
Expand All @@ -943,7 +947,7 @@ def test_update_conflicting_build_not_pushed(self, build_creation_time):
with fml_testing.mock_sends(api.Message):
approve_testing.main(['nosetests', 'some_config.ini'])

assert update.status == models.UpdateStatus.pending
assert update.status == update_status

bodhi = self.db.query(models.User).filter_by(name='bodhi').one()
cmnts = self.db.query(models.Comment).filter_by(update_id=update.id, user_id=bodhi.id)
Expand Down
1 change: 1 addition & 0 deletions news/3828.bug
@@ -0,0 +1 @@
Manage single build update conflicting builds.