Fix queries for Zuul trigger
Against a live gerrit, we observed that sometimes gerrit may not
return data for a change. In the case of the zuul trigger's
project-change-merged event, it's best to just ignore errors
for those changes and proceed.
Also, the gerrit trigger was attempting to parse the timing
results from the query. The test did not catch this because it
did not supply them in the mocked method. Correct this as well.
Also, double check that the query used was the one expected in
the test.
Change-Id: I792127d29f67f53a419eb94e9e0afb83b6e1bcb2
diff --git a/tests/base.py b/tests/base.py
index 1b82944..5f15297 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -369,6 +369,7 @@
self.fixture_dir = os.path.join(FIXTURE_DIR, 'gerrit')
self.change_number = 0
self.changes = {}
+ self.queries = []
def addFakeChange(self, project, branch, subject, status='NEW'):
self.change_number += 1
@@ -405,7 +406,10 @@
def simpleQuery(self, query):
# This is currently only used to return all open changes for a
# project
- return [change.query() for change in self.changes.values()]
+ self.queries.append(query)
+ l = [change.query() for change in self.changes.values()]
+ l.append({"type":"stats","rowCount":1,"runTimeMilliseconds":3})
+ return l
def startWatching(self, *args, **kw):
pass