From 80a45b77b52a655b09153baef9b9ee64a8161255 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 11 Aug 2022 18:44:07 -0700 Subject: Add detail to "depends on a change that failed to merge" The report message "This change depends on a change that failed to merge" (and a similar change for circular dependency bundles) is famously vague. To help users identify the actual problem, include URLs for which change(s) caused the problem so that users may more easily resolve the issue. Change-Id: Id8b9f8cf2c108703e9209e30bdc9a3933f074652 --- tests/unit/test_circular_dependencies.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/unit/test_circular_dependencies.py b/tests/unit/test_circular_dependencies.py index 2223008d5..292941c13 100644 --- a/tests/unit/test_circular_dependencies.py +++ b/tests/unit/test_circular_dependencies.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this software. If not, see . +import re import textwrap from zuul.model import PromoteEvent @@ -599,8 +600,23 @@ class TestGerritCircularDependencies(ZuulTestCase): self.assertIn("depends on a change that failed to merge", A.messages[-1]) + self.assertTrue(re.search(r'Change http://localhost:\d+/2 is needed', + A.messages[-1])) + self.assertFalse(re.search('Change .*? can not be merged', + A.messages[-1])) + self.assertIn("bundle that failed.", B.messages[-1]) + self.assertFalse(re.search('Change http://localhost:.*? is needed', + B.messages[-1])) + self.assertFalse(re.search('Change .*? can not be merged', + B.messages[-1])) + self.assertIn("bundle that failed.", C.messages[-1]) + self.assertFalse(re.search('Change http://localhost:.*? is needed', + C.messages[-1])) + self.assertFalse(re.search('Change .*? can not be merged', + C.messages[-1])) + self.assertEqual(A.data["status"], "NEW") self.assertEqual(B.data["status"], "NEW") self.assertEqual(C.data["status"], "NEW") @@ -2441,3 +2457,21 @@ class TestGithubCircularDependencies(ZuulTestCase): self.assertEqual(len(B.comments), 2) self.assertFalse(A.is_merged) self.assertFalse(B.is_merged) + + self.assertIn("part of a bundle that can not merge", + A.comments[-1]) + self.assertTrue( + re.search("Change https://github.com/gh/project/pull/1 " + "can not be merged", + A.comments[-1])) + self.assertFalse(re.search('Change .*? is needed', + A.comments[-1])) + + self.assertIn("part of a bundle that can not merge", + B.comments[-1]) + self.assertTrue( + re.search("Change https://github.com/gh/project/pull/1 " + "can not be merged", + B.comments[-1])) + self.assertFalse(re.search('Change .*? is needed', + B.comments[-1])) -- cgit v1.2.1