-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels
Description
Currently JenkinsRule.executeOnServer
does not work from RealJenkinsRule
, since ClosureExecuterAction
is registered as an extension from test code, which is ignored.
The following works but is not thread-safe:
@SuppressWarnings("deprecation")
static <V> V executeOnServer(JenkinsRule r, Callable<V> c) throws Exception {
ClosureExecuterAction cea = new ClosureExecuterAction();
r.jenkins.getExtensionList(RootAction.class).add(cea);
r.jenkins.getActions().add(cea);
try {
return r.executeOnServer(c);
} finally {
r.jenkins.getExtensionList(RootAction.class).remove(cea);
r.jenkins.getActions().remove(cea);
}
}