From fc468e4d4c12e7b75d2aceacead825bd075eca55 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Sat, 25 Jan 2014 18:32:09 -0800 Subject: [PATCH] Fix gerrit leave comment capability When adding support for short build_uuid's in AI6356a971ca250ddf5f01a9734f13d0b080a62c89 event.bugs was converted to a set since we would know can run classify multiple times on a singe event and don't want duplicate bugs. That patch didn't update the gerrit leave comment capabilties to understand event.bugs as a set (instead of a list). Change-Id: I9032e23e0e53426a57bebf42f4c4d4167624280e --- elastic_recheck/elasticRecheck.py | 2 +- elastic_recheck/tests/functional/test_gerrit_comment.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 946b1453..4e4f28ee 100755 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -265,7 +265,7 @@ For a code review which has been approved but failed to merge, you can reverify by leaving a comment like this: reverify bug %(bug)s""" % {'bugs': "\n- ".join(bug_urls), - 'bug': bugs[0]} + 'bug': list(bugs)[0]} else: message = ("I noticed tempest failed, refer to: " "https://wiki.openstack.org/wiki/" diff --git a/elastic_recheck/tests/functional/test_gerrit_comment.py b/elastic_recheck/tests/functional/test_gerrit_comment.py index ec036c0d..739dc363 100644 --- a/elastic_recheck/tests/functional/test_gerrit_comment.py +++ b/elastic_recheck/tests/functional/test_gerrit_comment.py @@ -33,7 +33,7 @@ class TestGerritComment(testtools.TestCase): self.gerrit = gerritlib.gerrit.Gerrit(host, self.user, port) def test_bug_found(self): - bug_numbers = ['1223158'] + bug_numbers = set(['1223158']) project = 'gtest-org/test' commit_id = '434,1' commit = '434' @@ -47,10 +47,10 @@ class TestGerritComment(testtools.TestCase): comment.get('message')) def test_bugs_found(self): - bug_numbers = ['1223158', '424242'] + bug_numbers = set(['1223158', '424242']) project = 'gtest-org/test' - commit_id = '434,1' - commit = '434' + commit_id = '781,1' + commit = '781' self.stream.leave_comment(project, commit_id, bug_numbers) result = self.gerrit.query(commit, comments=True) comments = result.get('comments')