Skip to content
Commit 7b1b50c8 authored by Kohsuke Kawaguchi's avatar Kohsuke Kawaguchi
Browse files

[JENKINS-22395] correcting the control test

As I step-executed the code, I discovered b2.getPreviousBuild() was getting invoked
between BRHF.drop(b1) and b2.dropLinks() call, in PeepholePermalink.RunListenerImpl.onDeleted()
because Run.delete() calls RunListener.fireDeleted(this).

Thus in effect the sequence of the call order was as follows:

        assertEquals(1, BRHF.drop(b1));
        b2.getPreviousBuild(); // happens indirectly in PeepholePermalink
        b2.delete();
        FreeStyleBuild b1a = b2.getPreviousBuild();

This defeats the purpose of the fix, because in this call sequence, by b2.dropLinks()
as implemented before f1430a25 will correctly fix up b1a.nextBuildR to b3.

For the test to work as intended, it is important that b2.previousBuildR.get()==null
during dropLinks(). That is what causes b2.getPreviousBuild() in the next line to go
load b1a, and sets up b1a.nextBuildR to b2, and trigger the assertion error.

Added a code to remove all RunListeners. With this change, the test now fails without
the fix in f1430a25.
parent 53e95ee5
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment