From 8341a45ded39511e8f4233c025f2a8c58ff91db6 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 29 Aug 2024 17:17:22 -0400 Subject: [PATCH] `javaOptions` for `InboundAgentRule` --- src/main/java/org/jvnet/hudson/test/InboundAgentRule.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java b/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java index 2cbd5cf9d..18746dc64 100644 --- a/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java +++ b/src/main/java/org/jvnet/hudson/test/InboundAgentRule.java @@ -97,6 +97,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; @@ -206,6 +207,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. * @@ -330,6 +336,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())); if (agentArguments.agentJnlpUrl.endsWith("computer/" + options.getName() + "/slave-agent.jnlp") && remotingVersion(agentArguments.agentJar).isNewerThanOrEqualTo(new VersionNumber("3186.vc3b_7249b_87eb_"))) { cmd.addAll(List.of("-url", agentArguments.agentJnlpUrl.replaceAll("computer/" + options.getName() + "/slave-agent.jnlp$", "")));