Merge "Re-enable test_merge_failure_reporters" into feature/zuulv3
diff --git a/tests/fixtures/layout-merge-failure.yaml b/tests/fixtures/layout-merge-failure.yaml
deleted file mode 100644
index 72bc9c9..0000000
--- a/tests/fixtures/layout-merge-failure.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-pipelines:
- - name: check
- manager: IndependentPipelineManager
- trigger:
- gerrit:
- - event: patchset-created
- success:
- gerrit:
- verified: 1
- failure:
- gerrit:
- verified: -1
-
- - name: post
- manager: IndependentPipelineManager
- trigger:
- gerrit:
- - event: ref-updated
- ref: ^(?!refs/).*$
-
- - name: gate
- manager: DependentPipelineManager
- failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
- merge-failure-message: "The merge failed! For more information..."
- trigger:
- gerrit:
- - event: comment-added
- approval:
- - approved: 1
- success:
- gerrit:
- verified: 2
- submit: true
- failure:
- gerrit:
- verified: -2
- merge-failure:
- gerrit:
- verified: -1
- smtp:
- to: you@example.com
- start:
- gerrit:
- verified: 0
- precedence: high
-
-projects:
- - name: org/project
- check:
- - project-merge:
- - project-test1
- - project-test2
- gate:
- - project-merge:
- - project-test1
- - project-test2
diff --git a/tests/fixtures/layouts/merge-failure.yaml b/tests/fixtures/layouts/merge-failure.yaml
new file mode 100644
index 0000000..228963f
--- /dev/null
+++ b/tests/fixtures/layouts/merge-failure.yaml
@@ -0,0 +1,74 @@
+- pipeline:
+ name: check
+ manager: independent
+ trigger:
+ gerrit:
+ - event: patchset-created
+ success:
+ gerrit:
+ verified: 1
+ failure:
+ gerrit:
+ verified: -1
+
+- pipeline:
+ name: post
+ manager: independent
+ trigger:
+ gerrit:
+ - event: ref-updated
+ ref: ^(?!refs/).*$
+
+- pipeline:
+ name: gate
+ manager: dependent
+ failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
+ merge-failure-message: "The merge failed! For more information..."
+ trigger:
+ gerrit:
+ - event: comment-added
+ approval:
+ - approved: 1
+ success:
+ gerrit:
+ verified: 2
+ submit: true
+ failure:
+ gerrit:
+ verified: -2
+ merge-failure:
+ gerrit:
+ verified: -1
+ smtp:
+ to: you@example.com
+ start:
+ gerrit:
+ verified: 0
+ precedence: high
+
+- job:
+ name: project-merge
+ hold-following-changes: true
+
+- job:
+ name: project-test1
+
+- job:
+ name: project-test2
+
+- project:
+ name: org/project
+ check:
+ jobs:
+ - project-merge
+ - project-test1:
+ dependencies: project-merge
+ - project-test2:
+ dependencies: project-merge
+ gate:
+ jobs:
+ - project-merge
+ - project-test1:
+ dependencies: project-merge
+ - project-test2:
+ dependencies: project-merge
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 7328a60..3ba402d 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -29,6 +29,7 @@
import testtools
import zuul.change_matcher
+from zuul.driver.gerrit import gerritreporter
import zuul.scheduler
import zuul.rpcclient
import zuul.model
@@ -3403,49 +3404,45 @@
self.assertEqual(0, len(A.messages))
- @skip("Disabled for early v3 development")
+ @simple_layout('layouts/merge-failure.yaml')
def test_merge_failure_reporters(self):
"""Check that the config is set up correctly"""
- self.updateConfigLayout(
- 'tests/fixtures/layout-merge-failure.yaml')
- self.sched.reconfigure(self.config)
- self.registerJobs()
-
+ tenant = self.sched.abide.tenants.get('tenant-one')
self.assertEqual(
"Merge Failed.\n\nThis change or one of its cross-repo "
"dependencies was unable to be automatically merged with the "
"current state of its repository. Please rebase the change and "
"upload a new patchset.",
- self.sched.layout.pipelines['check'].merge_failure_message)
+ tenant.layout.pipelines['check'].merge_failure_message)
self.assertEqual(
"The merge failed! For more information...",
- self.sched.layout.pipelines['gate'].merge_failure_message)
+ tenant.layout.pipelines['gate'].merge_failure_message)
self.assertEqual(
- len(self.sched.layout.pipelines['check'].merge_failure_actions), 1)
+ len(tenant.layout.pipelines['check'].merge_failure_actions), 1)
self.assertEqual(
- len(self.sched.layout.pipelines['gate'].merge_failure_actions), 2)
+ len(tenant.layout.pipelines['gate'].merge_failure_actions), 2)
self.assertTrue(isinstance(
- self.sched.layout.pipelines['check'].merge_failure_actions[0],
- zuul.reporter.gerrit.GerritReporter))
+ tenant.layout.pipelines['check'].merge_failure_actions[0],
+ gerritreporter.GerritReporter))
self.assertTrue(
(
- isinstance(self.sched.layout.pipelines['gate'].
+ isinstance(tenant.layout.pipelines['gate'].
merge_failure_actions[0],
- zuul.reporter.smtp.SMTPReporter) and
- isinstance(self.sched.layout.pipelines['gate'].
+ zuul.driver.smtp.smtpreporter.SMTPReporter) and
+ isinstance(tenant.layout.pipelines['gate'].
merge_failure_actions[1],
- zuul.reporter.gerrit.GerritReporter)
+ gerritreporter.GerritReporter)
) or (
- isinstance(self.sched.layout.pipelines['gate'].
+ isinstance(tenant.layout.pipelines['gate'].
merge_failure_actions[0],
- zuul.reporter.gerrit.GerritReporter) and
- isinstance(self.sched.layout.pipelines['gate'].
+ gerritreporter.GerritReporter) and
+ isinstance(tenant.layout.pipelines['gate'].
merge_failure_actions[1],
- zuul.reporter.smtp.SMTPReporter)
+ zuul.driver.smtp.smtpreporter.SMTPReporter)
)
)