summaryrefslogtreecommitdiff
path: root/tests/fakegithub.py
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2018-09-18 08:23:58 +0200
committerSimon Westphahl <simon.westphahl@bmw.de>2018-10-09 10:09:54 +0200
commit526a7ed9af678439bc1ae5a24504d18b20df36b3 (patch)
treeecb2d160b63967afc7c674d515593997e199c98b /tests/fakegithub.py
parent8d73978d71d8fe1cf089100affaa2dd97e51ad02 (diff)
downloadzuul-526a7ed9af678439bc1ae5a24504d18b20df36b3.tar.gz
Use merger to get list of files for pull-request
The Github pull requests files API only returns at max the first 300 changed files of a PR in alphabetical order. In case the PR has more than 300 changed files, it might be that Zuul is not considering changes to the config and not using them speculatively due to the incomplete file list. Also jobs using file filters might not be considered in case the relevant files are not in the list of files for a change. Change-Id: I10a593e26ac85b8c12ca9c82051cad809382f50a
Diffstat (limited to 'tests/fakegithub.py')
-rw-r--r--tests/fakegithub.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/fakegithub.py b/tests/fakegithub.py
index 86d680ce3..581b30686 100644
--- a/tests/fakegithub.py
+++ b/tests/fakegithub.py
@@ -250,8 +250,9 @@ class FakePull(object):
return FakeIssue(self._fake_pull_request)
def files(self):
+ # Github lists max. 300 files of a PR in alphabetical order
return [FakeFile(fn)
- for fn in self._fake_pull_request.files]
+ for fn in sorted(self._fake_pull_request.files)][:300]
@property
def head(self):
@@ -284,12 +285,14 @@ class FakePull(object):
'state': pr.state,
'head': {
'sha': pr.head_sha,
+ 'ref': pr.getPRReference(),
'repo': {
'full_name': pr.project
}
},
'merged': pr.is_merged,
- 'body': pr.body
+ 'body': pr.body,
+ 'changed_files': len(pr.files),
}
return data