Ooh, right, thanks!

In case there will be another newbie reading this:
The output from "mvn package" contains the last exception thrown, but it's 
not the whole log!

Running the individual test gave the full log:
mvn test -Dtest=com.google.jenkins.plugins.storage.ClassicUploadStepTest

In my case I haven't mocked out getDescriptor(), so it returns nullptr and 
the server dies with NullPointerException

Thanks for getting me on track again!



On Thursday, September 28, 2017 at 5:11:36 AM UTC-4, Robert Sandell wrote:
>
> A 500 server error is an indication that an exception was thrown in the 
> backend when the http request was made.
> You should see another stacktrace in the log just before the 
> FailingHttpstatusCodeException.
>
> /B
>
> 2017-09-27 22:53 GMT+02:00 'Alexandra Goultiaeva' via Jenkins Developers <
> [email protected] <javascript:>>:
>
>> 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 
>> <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 
>> <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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-dev/587d5c60-f702-4621-942c-6688b6a8d58b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Robert Sandell
> *Software Engineer*
> *CloudBees Inc.*
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/78d5d980-7105-4cb7-b6a7-c7bdfba193be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to