You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Egli (JIRA)" <ji...@apache.org> on 2014/07/15 09:57:05 UTC

[jira] [Resolved] (SLING-3760) Improvements for rerunning serverside tests

     [ https://issues.apache.org/jira/browse/SLING-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Egli resolved SLING-3760.
--------------------------------

    Resolution: Fixed

Thanks [~bdelacretaz]! I've added a version check too, so now the bundle is reinstalled only if there is a version mismatch (no semantic checks, just equals()) or if it's a SNAPSHOT. Have committed the patch, hence closing this ticket.

> Improvements for rerunning serverside tests
> -------------------------------------------
>
>                 Key: SLING-3760
>                 URL: https://issues.apache.org/jira/browse/SLING-3760
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>            Reporter: Stefan Egli
>            Assignee: Stefan Egli
>         Attachments: SLING-3760.patch
>
>
> As reported to the users@felix list at [0] there is an issue with the sling serverside testing. Namely, when running a serverside test against an existing server (be it sling launchpad or CQ) it works fine the first time, but any subsequent run fails with "No runnable methods" due to the fact that the junit-4.8.2.jar which is embedded in org.apache.sling.junit.core causes classloading problems: when the tests are run the second time, the sling.junit.core bundle is (re)installed via webconsoleclient.installBundle - which does a POST to the /system/console/bundles with action=install. This seems to cause the effects reported at [0] which are that Class.forName("org.junit.runner.RunWith", false, newBundleClassLoader) returns a class of which the classloader is the oldBundleClassLoader - and that in turn causes the getAnnotation() lookup to fail - and that causes "No runnable methods" to be reported.
> Long story short: it looks like repeatedly doing POST /system/console/bundles (action=install) leaves garbage around (ie the embedded jar's classes).
> Thus - besides analyzing this on the felix level - the quicker, suggested fix is to improve sling.testing.tools with the ability to:
>  * check if a bundle (that is part of the 'sling.additional.bundle' test configuration) is already installed - if so, then skip it
>  * skip above skip if the bundle in question is a SNAPSHOT one - to support developement - ie the actual test bundle, which is typically of SNAPSHOT version, should be repeatedly deployed
>  * upon reinstalling, first do a proper uninstall, then an install
> With these changes, I got my setup working. So I suggest to include this fix.
> I'm attaching a patch with the changes for review first though.
> [0] - http://markmail.org/thread/mwockachypg7liwu



--
This message was sent by Atlassian JIRA
(v6.2#6252)