Thanks for suggestion, Stephen!
I added to my POM:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.jenkins-ci.main:remoting</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
However, this didn't have any effect.
I think that the reason is that swarm-client is an uber-jar created via
shade plugin, so all remoting stuff is packed there. Also, if I override
version of org.jenkins-ci.main:remoting to 2.62 (the one used in Jenkins
core), Jenkins starts fine, but Swarm client connection to it fails with
this:
SEVERE: A thread (Thread-25/80) died unexpectedly due to an uncaught
exception, this may leave your Jenkins in a bad way and is usually
indicative of a bug in the code.
java.lang.SecurityException: class
"org.jenkinsci.remoting.engine.JnlpProtocolHandlerFactory"'s signer
information does not match signer information of other classes in the same
package
............
at hudson.remoting.Engine.innerRun(Engine.java:299)
at hudson.remoting.Engine.run(Engine.java:287)
Which is obviously caused by the same reason - 3.x remoting is inevitably
shipped with swarm-client, even if the Maven dependency itself is
removed/overridden.
So Surefire settings won't help.
Does it make sense to try to use Jenkins acceptance test harness for such
test?
2017-04-29 12:38 GMT+01:00 Stephen Connolly <[email protected]
>:
> There are surefire options to let you filter the test classpath
>
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#
> classpathDependencyExcludes
>
> On Sat 29 Apr 2017 at 10:36, Kirill <[email protected]> wrote:
>
>> Hi,
>>
>> I wrote a unit test (following guidelines at https://wiki.jenkins-ci.org/
>> display/JENKINS/Unit+Test) to test different usage scenarios of the
>> Swarm 3.4 slaves.
>> So I used:
>> - Jenkins test harness 2.21 (the latest one)
>> - Jenkins core 2.25
>> - Swarm client v3.4
>>
>> I wrote the test using @WithPlugin("swarm-3.4.hpi"), which brings up the
>> Swarm slave targeted at jenkins/getrootUrl(), but I get the following error
>> during Jenkins startup:
>>
>> INFO: Listed all plugins
>> Apr 29, 2017 10:30:32 AM hudson.ExtensionFinder$Sezpoz scout
>> WARNING: Failed to scout jenkins.slaves.DefaultJnlpSlaveReceiver
>> *java.lang.NoClassDefFoundError:
>> org/jenkinsci/remoting/engine/JnlpServerHandshake*
>>
>> It appeared that Jenkins 2.25 uses Jenkins remoting v2.62, but Swarm
>> client v3.4 which I use to create slave in my test uses Jenkins remoting
>> v3.4.1, which doesn't have that class. As the Swarm client's library is
>> loaded before Jenkins (and it does, as it's one of the Maven module's
>> dependencies, so gets onto classpath right away), embedded Jenkins started
>> by JenkinsRule gets it as well, neglecting the remoting.jar in its WEB-INF.
>>
>> If Jenkins would have been started in a JVM separate from the test's JVM,
>> there wouldn't be such problem. Of course, it wouldn't be a unit test then,
>> but the embedded Jenkins is still better to me than a standalone instance.
>> Maybe another idea would be to use Jenkins acceptance test harness?
>>
>> Any ideas are welcome! Thanks in advance, folks.
>>
>> --
>> 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/69f79be6-f504-43b4-8088-66a3172b1127%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-dev/69f79be6-f504-43b4-8088-66a3172b1127%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Sent from my phone
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-dev/rEk5FNjd7SU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-dev/CA%2BnPnMxdEaTbVXSTvkJHf%
> 3DXRkbiUbxAQm5FezfC1zwJC69K0Dg%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMxdEaTbVXSTvkJHf%3DXRkbiUbxAQm5FezfC1zwJC69K0Dg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAH45hb_Jszs30t4mmKBV5kXgex%3DGdfAN26%3DcaMP10dJnPJp-jA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.