diff --git a/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java b/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java index 9b8e96b36..06ef862f8 100644 --- a/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java +++ b/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java @@ -98,6 +98,7 @@ public static final class Options implements Serializable { private boolean secret; private boolean webSocket; @CheckForNull private String tunnel; + private List javaOptions = new ArrayList<>(); private boolean start = true; private final LinkedHashMap loggers = new LinkedHashMap<>(); private String label; @@ -207,6 +208,11 @@ public Builder tunnel(String tunnel) { return this; } + public Builder javaOptions(String... opts) { + options.javaOptions.addAll(List.of(opts)); + return this; + } + /** * Skip starting the agent. * @@ -331,6 +337,7 @@ public void start(AgentArguments agentArguments, Options options) throws Excepti cmd.add("-Xdebug"); cmd.add("Xrunjdwp:transport=dt_socket,server=y,address=" + (JenkinsRule.SLAVE_DEBUG_PORT + agentArguments.numberOfNodes - 1)); } + cmd.addAll(options.javaOptions); cmd.addAll(List.of("-jar", agentArguments.agentJar.getAbsolutePath())); var m = Pattern.compile("(.+)computer/([^/]+)/slave-agent[.]jnlp").matcher(agentArguments.agentJnlpUrl); if (m.matches() && remotingVersion(agentArguments.agentJar).isNewerThanOrEqualTo(new VersionNumber("3186.vc3b_7249b_87eb_"))) {