[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.
Loading
Please register or sign in to comment