Test cases failing with multiple levels of builds

41 views
Skip to first unread message

cjo

unread,
Jul 19, 2012, 8:46:02 AM7/19/12
to jenkin...@googlegroups.com
Hi all,

I'm looking at fixing JENKINS-14278[1] on the parameterized-trigger plugin.

I think I have fixed the issue, and I wrote tests that show the issues before making the changes.
Testcases commited at [2]
Code Fixes at [3]

However once making the changes to the plugin the test case still fails, in a different way. 
Before the fix the test case failed with the java.lang.IllegalArgumentException as per the error report,
after the fix the test case just hung and never completed.

The test case involves a matrix project being configured to call builds on other projects while waiting for them to finish
this gives the following build chain

Matrix parent -> Matrix child (triggers+block) -> Project1
Debugging through this shows that the Project1 never get called to run, 
which causes the parameterized-trigger to hang while waiting for the the build to finish at Future.get() in BlockableBuildTriggerConfig.[4]

If the test is configured to not block, the Matrix child builds complete and indicate that the subjobs were triggered, but the logs do not show them every running.


To see if this hang was related to the MatrixProject, I also created a test case where a build triggers another one which also triggers others .

ProjectA (triggers+block) -> ProjectB (triggers+block) -> ProjectC.

The same error ocurs in this case ProjectC does not seem to run, and also hangs at Future.get()[4]
So this looks like an issue in the test case running.

The issue is not "no free executors" as i have increased that to greater than the total combination of builds.


Can anyone see why the second level of jobs is not running in the test harness?
as when creating the jobs on a proper Jenkins instance they work with no issues at all.





Thanks for any help on this.

Chris.

Bruno P. Kinoshita

unread,
Jul 19, 2012, 8:15:30 PM7/19/12
to jenkin...@googlegroups.com
Hi Chris,

I've forked the repo at [1] from [2], did the usual changes to remove the Eclipse warnings, plus replaced hamcrest-1.2 by hamcrest-1.3 and then executed mvn -e -X clean test, and couldn't see any errors. Then I tried running TriggerBuilderTest with JUnit plug-in in Eclipse, and again all tests passed.

My settings: Debian 6 3.2 64bits, Java 1.6, Eclipse Juno, Maven 3.0.4.

Just my 0.02 cents. Maybe I've missed something from your problem, but I believe someone else here with more knowledge of parameterized-trigger-plugin or Jenkins codebase will be able to help you more :-)

Cheers,

[1] https://github.com/kinow/parameterized-trigger-plugin.git
[2] https://github.com/cjo9900/parameterized-trigger-plugin.git

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


>________________________________
> From: cjo <cjo.j...@gmail.com>
>To: jenkin...@googlegroups.com
>Sent: Thursday, 19 July 2012 9:46 AM
>Subject: Test cases failing with multiple levels of builds

cjo

unread,
Jul 20, 2012, 4:49:00 AM7/20/12
to jenkin...@googlegroups.com, Bruno P. Kinoshita
Did you build and test the JENKINS-14278 branch or the master one?

As I see you eclipse changes only on the master branch not JENKINS-14278.
which is where I have added the changes to the test cases.

Chris.

Bruno P. Kinoshita

unread,
Jul 20, 2012, 12:49:14 PM7/20/12
to cjo, jenkin...@googlegroups.com
Ops, sorry Chris, I only tested the master branch.


I've sent a pull request [1] with a change the seems to fix this issue. Below is the pull request message. Cheers.

>>>
JENKINS-14278: added code to make sure that the number of executors is updated
For tracking what was causing this issue, I put a breakpoint before the first 
Future<?>#get() method call, as the execution was dying there. Then I called
the HudsonTestCase#getURL() method, to get the Jenkins URL (it's very convenient).
This way I could see the jobs configuration, it was very useful since I don't 
know very well the objects created by parameterized-trigger-plugin. Then I
noticed there were only two executors.
Following the debug stack, I found later that project1 was waiting for another 
project (I think it was projectZ4 maybe? sorry, I closed the debugger already) and 
that this latter project was waiting for another project that was never executed.
Going back to Jenkins main page, there were only two executors, even after 
Hudson#setNumExecutors(10) was called. Then I had a quick look at Jenkins#doSubmitConfig(...) 
method, and realized that after updating the number of executors, you had to 
update the nodes/computers configuration as well.
Then, as I'm a lazy bastard, I went to my search engine and searched for 
Jenkins setnumexecutors and found some code with the following code snippet: 
hudson.setNodes(hudson.getNodes());
I think the method that needs to be called after setNumExecutors is updateComputerList, 
that is package protected, but is called from this setNodes method.
And then all the tests passed :)
Other files were changed to remove warnings in Eclipse, to use hamcrest-1.3 as 
maven couldn't find hamcrest-1.2 or for compliance with Java 1.5 (@override 
annotations). These changes are not required to fix this issue.
Hope that helps.
Bruno
<<<


[1] https://github.com/cjo9900/parameterized-trigger-plugin/pull/1

>________________________________
> From: cjo <cjo.j...@gmail.com>
>To: jenkin...@googlegroups.com

>Cc: Bruno P. Kinoshita <brunod...@yahoo.com.br>
>Sent: Friday, 20 July 2012 5:49 AM
>Subject: Re: Test cases failing with multiple levels of builds

>>>Before the fix the test case failed with the java.lang. IllegalArgumentException as per the error report,

Bruno P. Kinoshita

unread,
Jul 20, 2012, 2:12:26 PM7/20/12
to cjo, jenkin...@googlegroups.com
Almost forgot Chris, I also saw some errors regarding missing descriptor for TriggerBuilder. Adding DescriptorImpl() { super(TriggerBuilder.class); } constructor to its descriptor fixes that kind or warning ;)

Laters
 

From: Bruno P. Kinoshita <brunod...@yahoo.com.br>
To: cjo <cjo.j...@gmail.com>; "jenkin...@googlegroups.com" <jenkin...@googlegroups.com>
Sent: Friday, 20 July 2012 1:49 PM

Christopher Johnson

unread,
Jul 20, 2012, 2:56:12 PM7/20/12
to Bruno P. Kinoshita, jenkin...@googlegroups.com
Thanks for that, it looks good.

Will run the merge and will check the warnings,
and then push to the main Jenkinsci project

I will have to remove the <pluginManagement> section from the pom
though as it only required for the eclipse and most, other plugins do
not have this section.

Chris.

Bruno P. Kinoshita

unread,
Jul 20, 2012, 2:57:47 PM7/20/12
to jenkin...@googlegroups.com
Hi Chris, no problem, feel free to filter that pull request as needed :-)

Cheers
 

From: Christopher Johnson <cjo.j...@gmail.com>
To: Bruno P. Kinoshita <brunod...@yahoo.com.br>
Cc: "jenkin...@googlegroups.com" <jenkin...@googlegroups.com>
Sent: Friday, 20 July 2012 3:56 PM
Reply all
Reply to author
Forward
0 new messages