[JIRA] (JENKINS-41827) JenkinsRule mode to use realistic class loading

4 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Feb 7, 2017, 3:33:02 PM2/7/17
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / New Feature JENKINS-41827
JenkinsRule mode to use realistic class loading
Issue Type: New Feature New Feature
Assignee: Oliver Gondža
Components: jenkins-test-harness
Created: 2017/Feb/07 8:32 PM
Labels: testing classloader
Priority: Critical Critical
Reporter: Jesse Glick

JenkinsRule-based tests generally load not only Jenkins core but also all plugins from ${java.class.path}, i.e., the Maven test-scoped classpath. This is convenient in some ways but also means that class loading is done in a very different way than in an actual production instance, or even mvn hpi:run, making it very hard to test changes like JENKINS-26192 without using the much clunkier, slower, and flakier acceptance-test-harness. It also means that we are forever fighting with Maven's weird transitive dependency management (JENKINS-41631, JENKINS-39301, etc.).

There should be an option to run JenkinsRule in a mode whereby the test classpath is only used to load Jetty; Jenkins core and its WEB-INF/lib/*.jar (including modules!) is loaded in a derivative class loader; and then plugins are discovered from the test classpath, transitive dependencies computed and verified, and finally loaded in the real plugin class loader (probably using *.jpl files to allow us to still load from unpacked development trees). Finally, the test suite itself needs to be reloaded in a fresh loader parented to UberClassLoader, and executed from there.

NbModuleSuite demonstrates the concept, though the details would be rather different for Jenkins.

There are a lot of details to be checked, such as

  • @TestExtension handling
  • PluginWorkspaceMap support for coördinated snapshot development
  • moving InjectedTest from HudsonTestCase so that it can use the new mode
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Feb 8, 2018, 12:28:03 PM2/8/18
to jenkinsc...@googlegroups.com
Jesse Glick commented on New Feature JENKINS-41827
 
Re: JenkinsRule mode to use realistic class loading

Durability tests turned out to be feasible with a simple addition to RestartableJenkinsRule.

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Mar 6, 2018, 11:48:04 AM3/6/18
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Labels: classloader essentials testing

batmat@batmat.net (JIRA)

unread,
Sep 28, 2018, 5:50:09 AM9/28/18
to jenkinsc...@googlegroups.com
Baptiste Mathus updated an issue
Change By: Baptiste Mathus
Labels: classloader essentials evergreen testing
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

batmat@batmat.net (JIRA)

unread,
Sep 28, 2018, 6:01:26 AM9/28/18
to jenkinsc...@googlegroups.com

boards@gmail.com (JIRA)

unread,
Apr 11, 2019, 3:41:03 PM4/11/19
to jenkinsc...@googlegroups.com
Matt Sicker commented on New Feature JENKINS-41827
 
Re: JenkinsRule mode to use realistic class loading

Perhaps consider Arquillian as a framework for that?

jglick@cloudbees.com (JIRA)

unread,
Apr 11, 2019, 3:54:03 PM4/11/19
to jenkinsc...@googlegroups.com

I suspect Arquillian would be much more trouble than it is worth, since Jenkins uses only a little bit of the Servlet system and then has its own big complex module system completely outside of that.

ullrich.hafner@gmail.com (JIRA)

unread,
Nov 13, 2019, 6:09:02 PM11/13/19
to jenkinsc...@googlegroups.com

Can this issue be also the root case for my failing tests? I moved the JS files of my warnings plugin into separate plugins to simplify the reuse in other plugins. Now all UI tests fail since the JS files are not found any more: example failure - 404. I get the 404 for all JS scripts that are part of one of my dependencies (the JS files in my plugin seem to work). Everything works fine in a real Jenkins instance.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

ullrich.hafner@gmail.com (JIRA)

unread,
Nov 13, 2019, 6:10:03 PM11/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-41827
Can this issue be also the root case for my failing tests? I moved the JS files of my warnings plugin into separate plugins to simplify the reuse in other plugins. Now all UI tests fail since the JS files are not found any more: [example failure - 404|https://ci.jenkins.io/job/Plugins/job/warnings-ng-plugin/job/web-jars/10/testReport/junit/io.jenkins.plugins.analysis.core.scm/GitBlamerITest/Linux_Build___shouldBlameWithBuildOutOfTree/]. I get the 404 for all JS scripts that are part of one of my dependencies (the JS files in my plugin seem to work). Everything works fine in a real Jenkins instance.

{noformat}
java.io.IOException: Unable to download JavaScript from 'http://localhost:39309/plugin/data-tables-api/js/table.js' (status 404).
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1054)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:982)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:362)
at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:236)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:257)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:792)
{noformat}

jglick@cloudbees.com (JIRA)

unread,
Apr 27, 2020, 8:59:06 AM4/27/20
to jenkinsc...@googlegroups.com

Optional dependencies (JENKINS-19508) could also be verified by a harness which allowed some of the plugins in the test classpath to be omitted from the set.

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages