Merge "Re-enable test_stuck_job_cleanup" into feature/zuulv3

This commit is contained in:
Jenkins 2017-03-27 21:13:26 +00:00 committed by Gerrit Code Review
commit 8f1da2bdef
4 changed files with 38 additions and 26 deletions

View File

@ -1878,11 +1878,18 @@ class ZuulTestCase(BaseTestCase):
def commitLayoutUpdate(self, orig_name, source_name):
source_path = os.path.join(self.test_root, 'upstream',
source_name, 'zuul.yaml')
with open(source_path, 'r') as nt:
before = self.addCommitToRepo(
orig_name, 'Pulling content from %s' % source_name,
{'zuul.yaml': nt.read()})
source_name)
to_copy = ['zuul.yaml']
for playbook in os.listdir(os.path.join(source_path, 'playbooks')):
to_copy.append('playbooks/{}'.format(playbook))
commit_data = {}
for source_file in to_copy:
source_file_path = os.path.join(source_path, source_file)
with open(source_file_path, 'r') as nt:
commit_data[source_file] = nt.read()
before = self.addCommitToRepo(
orig_name, 'Pulling content from %s' % source_name,
commit_data)
return before
def addEvent(self, connection, event):

View File

@ -0,0 +1,2 @@
- hosts: all
tasks: []

View File

@ -1,9 +1,7 @@
includes:
- python-file: custom_functions.py
pipelines:
- name: check
manager: IndependentPipelineManager
- pipeline:
name: check
manager: independent
source: gerrit
trigger:
gerrit:
- event: patchset-created
@ -14,9 +12,12 @@ pipelines:
gerrit:
verified: -1
- name: gate
manager: DependentPipelineManager
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
- pipeline:
name: gate
manager: dependent
success-message: Build succeeded (gate).
source:
gerrit
trigger:
gerrit:
- event: comment-added
@ -34,10 +35,15 @@ pipelines:
verified: 0
precedence: high
projects:
- name: org/project
- job:
name: gate-noop
- project:
name: org/project
merge-mode: cherry-pick
check:
- gate-noop
jobs:
- gate-noop
gate:
- gate-noop
jobs:
- gate-noop

View File

@ -1950,28 +1950,25 @@ class TestScheduler(ZuulTestCase):
self.assertReportedStat('test-timing', '3|ms')
self.assertReportedStat('test-gauge', '12|g')
@skip("Disabled for early v3 development")
def test_stuck_job_cleanup(self):
"Test that pending jobs are cleaned up if removed from layout"
# This job won't be registered at startup because it is not in
# the standard layout, but we need it to already be registerd
# for when we reconfigure, as that is when Zuul will attempt
# to run the new job.
self.worker.registerFunction('build:gate-noop')
# We want to hold the project-merge job that the fake change enqueues
self.gearman_server.hold_jobs_in_queue = True
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
A.addApproval('code-review', 2)
self.fake_gerrit.addEvent(A.addApproval('approved', 1))
self.waitUntilSettled()
# The assertion is that we have one job in the queue, project-merge
self.assertEqual(len(self.gearman_server.getQueue()), 1)
self.updateConfigLayout(
'tests/fixtures/layout-no-jobs.yaml')
self.commitLayoutUpdate('common-config', 'layout-no-jobs')
self.sched.reconfigure(self.config)
self.waitUntilSettled()
self.gearman_server.release('gate-noop')
self.waitUntilSettled()
# asserting that project-merge is removed from queue
self.assertEqual(len(self.gearman_server.getQueue()), 0)
self.assertTrue(self.sched._areAllBuildsComplete())