Re-enable test_footer_message
This enables the test and limits it to look only for the header and footers
in the message, since the url pattern does not currently function the same as
it did in v2.
Change-Id: I0ae95c4f7755011e5d9f73879867a06df8d0d223
Story: 2000773
Task: 3472
diff --git a/tests/fixtures/config/single-tenant/git/layout-footer-message/playbooks/project-test1.yaml b/tests/fixtures/config/single-tenant/git/layout-footer-message/playbooks/project-test1.yaml
new file mode 100644
index 0000000..f679dce
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-footer-message/playbooks/project-test1.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+ tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-footer-message/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-footer-message/zuul.yaml
new file mode 100644
index 0000000..0c04070
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-footer-message/zuul.yaml
@@ -0,0 +1,38 @@
+- pipeline:
+ name: gate
+ manager: dependent
+ success-message: Build succeeded (gate).
+ source:
+ gerrit
+ failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
+ footer-message: For CI problems and help debugging, contact ci@example.org
+ trigger:
+ gerrit:
+ - event: comment-added
+ approval:
+ - approved: 1
+ success:
+ smtp:
+ to: you@example.com
+ gerrit:
+ verified: 2
+ submit: true
+ failure:
+ gerrit:
+ verified: -2
+ smtp:
+ to: you@example.com
+ start:
+ gerrit:
+ verified: 0
+ precedence: high
+
+- job:
+ name: project-test1
+# success-url: http://logs.exxxample.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}
+- project:
+ name: org/project
+ gate:
+ jobs:
+ - project-test1
+
diff --git a/tests/fixtures/layout-footer-message.yaml b/tests/fixtures/layout-footer-message.yaml
deleted file mode 100644
index 7977c19..0000000
--- a/tests/fixtures/layout-footer-message.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-includes:
- - python-file: custom_functions.py
-
-pipelines:
- - name: gate
- manager: DependentPipelineManager
- failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
- footer-message: For CI problems and help debugging, contact ci@example.org
- trigger:
- gerrit:
- - event: comment-added
- approval:
- - approved: 1
- success:
- gerrit:
- verified: 2
- submit: true
- smtp:
- to: success@example.org
- failure:
- gerrit:
- verified: -2
- smtp:
- to: failure@example.org
- start:
- gerrit:
- verified: 0
- precedence: high
-
-projects:
- - name: org/project
- gate:
- - test1
- - test2
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 6426692..b0a7324 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -3358,17 +3358,14 @@
self.launch_server.release()
self.waitUntilSettled()
- @skip("Disabled for early v3 development")
def test_footer_message(self):
"Test a pipeline's footer message is correctly added to the report."
- self.updateConfigLayout(
- 'tests/fixtures/layout-footer-message.yaml')
+ self.updateConfigLayout('layout-footer-message')
self.sched.reconfigure(self.config)
- self.registerJobs()
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
A.addApproval('code-review', 2)
- self.launch_server.failJob('test1', A)
+ self.launch_server.failJob('project-test1', A)
self.fake_gerrit.addEvent(A.addApproval('approved', 1))
self.waitUntilSettled()
@@ -3379,25 +3376,17 @@
self.assertEqual(2, len(self.smtp_messages))
- failure_body = """\
+ failure_msg = """\
Build failed. For information on how to proceed, see \
-http://wiki.example.org/Test_Failures
+http://wiki.example.org/Test_Failures"""
-- test1 http://logs.example.com/1/1/gate/test1/0 : FAILURE in 0s
-- test2 http://logs.example.com/1/1/gate/test2/1 : SUCCESS in 0s
-
+ footer_msg = """\
For CI problems and help debugging, contact ci@example.org"""
- success_body = """\
-Build succeeded.
-
-- test1 http://logs.example.com/2/1/gate/test1/2 : SUCCESS in 0s
-- test2 http://logs.example.com/2/1/gate/test2/3 : SUCCESS in 0s
-
-For CI problems and help debugging, contact ci@example.org"""
-
- self.assertEqual(failure_body, self.smtp_messages[0]['body'])
- self.assertEqual(success_body, self.smtp_messages[1]['body'])
+ self.assertTrue(self.smtp_messages[0]['body'].startswith(failure_msg))
+ self.assertTrue(self.smtp_messages[0]['body'].endswith(footer_msg))
+ self.assertFalse(self.smtp_messages[1]['body'].startswith(failure_msg))
+ self.assertTrue(self.smtp_messages[1]['body'].endswith(footer_msg))
@skip("Disabled for early v3 development")
def test_merge_failure_reporters(self):