Add test for dependent changes not in a pipeline

When a series of dependent changes get enqueued into a dependent
pipeline that they don't participate in, they are removed from the
pipeline in series.  The first one is removed without incident, but
the second might see the failure of its dependency to merge as a
transitive merge failure.

This used to cause the second change to report, but this commit's
parent fixed that.  Add an explicit test for this situation to verify
and avoid regression.

Change-Id: I85727897c145dab998562dc138affcf08c671593
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index b55dd7f..8eba623 100755
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -895,6 +895,26 @@
             dict(name='project-test1', result='FAILURE', changes='1,1 2,1'),
         ], ordered=False)
 
+    def test_dynamic_dependent_pipeline_absent(self):
+        # Test that a series of dependent changes don't report merge
+        # failures to a pipeline they aren't in.
+        A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
+        B = self.fake_gerrit.addFakeChange('org/project', 'master', 'B')
+        B.setDependsOn(A, 1)
+
+        A.addApproval('Code-Review', 2)
+        A.addApproval('Approved', 1)
+        B.addApproval('Code-Review', 2)
+        self.fake_gerrit.addEvent(B.addApproval('Approved', 1))
+        self.waitUntilSettled()
+        self.assertEqual(A.reported, 0,
+                         "A should not report")
+        self.assertEqual(A.data['status'], 'NEW')
+        self.assertEqual(B.reported, 0,
+                         "B should not report")
+        self.assertEqual(B.data['status'], 'NEW')
+        self.assertHistory([])
+
 
 class TestAnsible(AnsibleZuulTestCase):
     # A temporary class to hold new tests while others are disabled