I am working on Jenkins Unit tests, and am trying to add a round trip test 
<https://wiki.jenkins.io/display/JENKINS/Unit+Test#UnitTest-Configurationround-triptesting>
.
Unfortunately, I keep getting errors.

Here is a branch with my (broken) changes 
<https://github.com/agoulti/google-storage-plugin/tree/brokenUnitTest>.

I've added the roundtrip test ClassicUploadStepTest 
<https://github.com/agoulti/google-storage-plugin/blob/brokenUnitTest/src/test/java/com/google/jenkins/plugins/storage/ClassicUploadStepTest.java>
When I run the test, I get the following error:
*com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server 
Error for http://localhost:33657/jenkins/job/test0/configure*

I've played with the test a bit, and found that if I comment out my setUp, 
the test works. It seems that the test breaks as soon as I add the 
following line:

SystemCredentialsProvider.getInstance().getCredentials().add(credentials);

I'm somewhat at a loss as to how to debug this further.
Stack traces seem to point to where the exception is thrown 
(throwFailingHttpStatusCodeExceptionIfNecessary), and not where the error 
occurred. The error itself is quite generic.

Any hints on how to approach this?
How can I try to get at the root cause for the 500?

Thanks!


PS. This is the stack trace I'm getting:
*testRoundtrip(com.google.jenkins.plugins.storage.ClassicUploadStepTest)  
Time elapsed: 6.1 sec  <<< ERROR!*
*com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Server 
Error for http://localhost:37367/jenkins/job/test0/configure*
* at 
com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:535)*
* at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)*
* at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415)*
* at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400)*
* at 
org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2148)*
* at 
org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2128)*
* at 
org.jvnet.hudson.test.JenkinsRule$WebClient.getPage(JenkinsRule.java:2084)*
* at 
org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1077)*
* at 
org.jvnet.hudson.test.JenkinsRule.configRoundtrip(JenkinsRule.java:1087)*
* at 
com.google.jenkins.plugins.storage.ClassicUploadStepTest.ConfigurationRoundTripTest(ClassicUploadStepTest.java:82)*
* at 
com.google.jenkins.plugins.storage.ClassicUploadStepTest.testRoundtrip(ClassicUploadStepTest.java:89)*

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to