Re-enable the duplicate_pipeline test

Created separate class for it to use the new config in fixtures
named 'duplicate-pipeline'.

Also, modified it to use the new history assertion.

Change-Id: If6d9ac502122de1022efbebf91abd83f947b940e
changes/92/384192/5
Arie 6 years ago
parent 381ca3a3f4
commit b6f068c62e
  1. 46
      tests/fixtures/config/duplicate-pipeline/git/common-config/zuul.yaml
  2. 1
      tests/fixtures/config/duplicate-pipeline/git/org_project/README
  3. 6
      tests/fixtures/config/duplicate-pipeline/main.yaml
  4. 52
      tests/test_scheduler.py

@ -0,0 +1,46 @@
- pipeline:
name: dup1
manager: independent
success-message: Build succeeded (dup1).
source:
gerrit
trigger:
gerrit:
- event: change-restored
success:
gerrit:
verified: 1
failure:
gerrit:
verified: -1
- pipeline:
name: dup2
manager: independent
success-message: Build succeeded (dup2).
source:
gerrit
trigger:
gerrit:
- event: change-restored
success:
gerrit:
verified: 1
failure:
gerrit:
verified: -1
- job:
name: project-test1
- project:
name: org/project
dup1:
queue: integrated
jobs:
- project-test1
dup2:
queue: integrated
jobs:
- project-test1

@ -0,0 +1,6 @@
- tenant:
name: tenant-duplicate
source:
gerrit:
config-repos:
- common-config

@ -109,30 +109,6 @@ class TestScheduler(ZuulTestCase):
self.assertEqual(self.getJobFromHistory('project-test1').node,
'image2')
@skip("Disabled for early v3 development")
def test_duplicate_pipelines(self):
"Test that a change matching multiple pipelines works"
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
self.fake_gerrit.addEvent(A.getChangeRestoredEvent())
self.waitUntilSettled()
self.assertEqual(len(self.history), 2)
self.history[0].name == 'project-test1'
self.history[1].name == 'project-test1'
self.assertEqual(len(A.messages), 2)
if 'dup1/project-test1' in A.messages[0]:
self.assertIn('dup1/project-test1', A.messages[0])
self.assertNotIn('dup2/project-test1', A.messages[0])
self.assertNotIn('dup1/project-test1', A.messages[1])
self.assertIn('dup2/project-test1', A.messages[1])
else:
self.assertIn('dup1/project-test1', A.messages[1])
self.assertNotIn('dup2/project-test1', A.messages[1])
self.assertNotIn('dup1/project-test1', A.messages[0])
self.assertIn('dup2/project-test1', A.messages[0])
def test_parallel_changes(self):
"Test that changes are tested in parallel and merged in series"
@ -4687,3 +4663,31 @@ For CI problems and help debugging, contact ci@example.org"""
self.assertIn(
'- docs-draft-test2 https://server/job/docs-draft-test2/1/',
body[3])
class TestDuplicatePipeline(ZuulTestCase):
tenant_config_file = 'config/duplicate-pipeline/main.yaml'
def test_duplicate_pipelines(self):
"Test that a change matching multiple pipelines works"
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
self.fake_gerrit.addEvent(A.getChangeRestoredEvent())
self.waitUntilSettled()
self.assertHistory([
dict(name='project-test1', result='SUCCESS', changes='1,1',
pipeline='dup1'),
dict(name='project-test1', result='SUCCESS', changes='1,1',
pipeline='dup2'),
])
self.assertEqual(len(A.messages), 2)
self.assertIn('dup1', A.messages[0])
self.assertNotIn('dup2', A.messages[0])
self.assertIn('project-test1', A.messages[0])
self.assertIn('dup2', A.messages[1])
self.assertNotIn('dup1', A.messages[1])
self.assertIn('project-test1', A.messages[1])

Loading…
Cancel
Save