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

resultsdb/waiverdb: skip updating gating status if it's ignored #5202

Merged
merged 1 commit into from
Apr 17, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bodhi-server/bodhi/server/consumers/resultsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __call__(self, message: fedora_messaging.api.Message):
if (
(passed and status == TestGatingStatus.passed)
or (not passed and status == TestGatingStatus.failed)
or status == TestGatingStatus.ignored
):
log.debug("Not updating test_gating_status as no chance of a change")
return
Expand Down
13 changes: 8 additions & 5 deletions bodhi-server/bodhi/server/consumers/waiverdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ def __call__(self, message: fedora_messaging.api.Message):
with self.db_factory():
# find the update
update = update_from_db_message(message.id, subject)
# update the gating status unless it's already "passed", a
# waiver can't change it from passed to anything else
if update and update.test_gating_status != TestGatingStatus.passed:
log.info(f"Updating the test_gating_status for: {update.alias}")
update.update_test_gating_status()
if update:
# update the gating status unless it's already "passed" (a
# waiver can't change it from passed to anything else) or
# "ignored" (that's not going to change either)
updtgs = update.test_gating_status
if updtgs not in (TestGatingStatus.passed, TestGatingStatus.ignored):
log.info(f"Updating the test_gating_status for: {update.alias}")
update.update_test_gating_status()
14 changes: 12 additions & 2 deletions bodhi-server/tests/consumers/test_resultsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,15 @@ def test_resultsdb_passed_koji_test(self):
update.test_gating_status = models.TestGatingStatus.waiting
self.handler(testmsg)
assert update.test_gating_status == models.TestGatingStatus.passed
# now check we don't update if already passed
# now check we don't update if already passed...
with mock.patch("bodhi.server.models.Update.update_test_gating_status") as updmock:
self.handler(testmsg)
assert updmock.call_count == 0
# ...or ignored
update.test_gating_status = models.TestGatingStatus.ignored
self.handler(testmsg)
assert updmock.call_count == 0
assert update.test_gating_status == models.TestGatingStatus.ignored

def test_resultsdb_failed_koji_test(self):
"""
Expand Down Expand Up @@ -152,10 +157,15 @@ def test_resultsdb_failed_koji_test(self):
update.test_gating_status = models.TestGatingStatus.waiting
self.handler(testmsg)
assert update.test_gating_status == models.TestGatingStatus.failed
# now check we don't update if already failed
# now check we don't update if already failed...
with mock.patch("bodhi.server.models.Update.update_test_gating_status") as updmock:
self.handler(testmsg)
assert updmock.call_count == 0
# ...or ignored
update.test_gating_status = models.TestGatingStatus.ignored
self.handler(testmsg)
assert updmock.call_count == 0
assert update.test_gating_status == models.TestGatingStatus.ignored

def test_resultsdb_bodhi_tests(self):
"""
Expand Down
7 changes: 6 additions & 1 deletion bodhi-server/tests/consumers/test_waiverdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ def test_waiverdb_koji_waiver(self):
update.test_gating_status = models.TestGatingStatus.waiting
self.handler(testmsg)
assert update.test_gating_status == models.TestGatingStatus.passed
# now check we don't update if already passed
# now check we don't update if already passed...
with mock.patch("bodhi.server.models.Update.update_test_gating_status") as updmock:
self.handler(testmsg)
assert updmock.call_count == 0
# ...or ignored
update.test_gating_status = models.TestGatingStatus.ignored
self.handler(testmsg)
assert updmock.call_count == 0
assert update.test_gating_status == models.TestGatingStatus.ignored

def test_waiverdb_bodhi_waiver(self):
"""
Expand Down
1 change: 1 addition & 0 deletions news/PR5202.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bodhi will not try to recalculate the gating status in response to a new result or a new waiver if the status is `ignored`