From 02de81532222234b002f48e4079c9fe6afe20279 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Mon, 6 Jan 2025 08:36:04 -0800 Subject: [PATCH] Use unsecure entropy source in docker packaging tests --- .../elasticsearch/packaging/util/docker/DockerRun.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java index 5dc47993072a8..58420edb841d3 100644 --- a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java +++ b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java @@ -29,6 +29,9 @@ */ public class DockerRun { + // Use less secure entropy source to avoid hanging when generating certificates + private static final String DEFAULT_JAVA_OPTS = "-Djava.security.egd=file:/dev/urandom"; + private Distribution distribution; private final Map envVars = new HashMap<>(); private final Map volumes = new HashMap<>(); @@ -112,6 +115,13 @@ String build() { // Limit container memory cmd.add("--memory " + memory); + // Add default java opts + if (this.envVars.containsKey("CLI_JAVA_OPTS")) { + this.envVars.put("CLI_JAVA_OPTS", this.envVars.get("CLI_JAVA_OPTS") + " " + DEFAULT_JAVA_OPTS); + } else { + this.envVars.put("CLI_JAVA_OPTS", DEFAULT_JAVA_OPTS); + } + this.envVars.forEach((key, value) -> cmd.add("--env " + key + "=\"" + value + "\"")); // Map ports in the container to the host, so that we can send requests