Merge "Fix AttributeError when handle periodic job with github driver"
This commit is contained in:
commit
d07c3d2749
|
@ -0,0 +1,25 @@
|
|||
- pipeline:
|
||||
name: periodic
|
||||
manager: independent
|
||||
trigger:
|
||||
timer:
|
||||
- time: '* * * * * */1'
|
||||
|
||||
- job:
|
||||
name: base
|
||||
parent: null
|
||||
run: playbooks/base.yaml
|
||||
|
||||
- job:
|
||||
name: project-bitrot
|
||||
nodeset:
|
||||
nodes:
|
||||
- name: static
|
||||
label: ubuntu-xenial
|
||||
run: playbooks/project-bitrot.yaml
|
||||
|
||||
- project:
|
||||
name: org/project
|
||||
periodic:
|
||||
jobs:
|
||||
- project-bitrot
|
|
@ -210,6 +210,34 @@ class TestGithubDriver(ZuulTestCase):
|
|||
self.waitUntilSettled()
|
||||
self.assertEqual(1, len(self.history))
|
||||
|
||||
@simple_layout('layouts/basic-github.yaml', driver='github')
|
||||
def test_timer_event(self):
|
||||
self.executor_server.hold_jobs_in_build = True
|
||||
self.commitConfigUpdate('org/common-config',
|
||||
'layouts/timer-github.yaml')
|
||||
self.sched.reconfigure(self.config)
|
||||
time.sleep(2)
|
||||
self.waitUntilSettled()
|
||||
self.assertEqual(len(self.builds), 1)
|
||||
self.executor_server.hold_jobs_in_build = False
|
||||
# Stop queuing timer triggered jobs so that the assertions
|
||||
# below don't race against more jobs being queued.
|
||||
self.commitConfigUpdate('org/common-config',
|
||||
'layouts/basic-github.yaml')
|
||||
self.sched.reconfigure(self.config)
|
||||
self.waitUntilSettled()
|
||||
# If APScheduler is in mid-event when we remove the job, we
|
||||
# can end up with one more event firing, so give it an extra
|
||||
# second to settle.
|
||||
time.sleep(1)
|
||||
self.waitUntilSettled()
|
||||
self.executor_server.release()
|
||||
self.waitUntilSettled()
|
||||
self.assertHistory([
|
||||
dict(name='project-bitrot', result='SUCCESS',
|
||||
ref='refs/heads/master'),
|
||||
], ordered=False)
|
||||
|
||||
@simple_layout('layouts/dequeue-github.yaml', driver='github')
|
||||
def test_dequeue_pull_synchronized(self):
|
||||
self.executor_server.hold_jobs_in_build = True
|
||||
|
|
|
@ -722,7 +722,8 @@ class GithubConnection(BaseConnection):
|
|||
change.newrev = event.newrev
|
||||
change.url = self.getGitwebUrl(project, sha=event.newrev)
|
||||
change.source_event = event
|
||||
change.files = self.getPushedFileNames(event)
|
||||
if hasattr(event, 'commits'):
|
||||
change.files = self.getPushedFileNames(event)
|
||||
return change
|
||||
|
||||
def _getChange(self, project, number, patchset=None, refresh=False):
|
||||
|
|
Loading…
Reference in New Issue