Skip to content

Commit 547c9d6

Browse files
committed
Tweak java command running lookup to work with wolfi
1 parent 9de0dd6 commit 547c9d6

File tree

1 file changed

+7
-3
lines changed
  • qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker

1 file changed

+7
-3
lines changed

qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/Docker.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,14 @@ public static void waitForElasticsearchToStart() {
185185
try {
186186
// Give the container enough time for security auto-configuration or a chance to crash out
187187
Thread.sleep(STARTUP_SLEEP_INTERVAL_MILLISECONDS);
188-
188+
String detectCommand =
189+
"for pid in $(ps -eo pid,comm | grep java | awk '\\''{print $1}'\\''); do cmdline=$(tr \"\\0\" \" \" < /proc/$pid/cmdline 2>/dev/null); [[ $cmdline == *org.elasticsearch.bootstrap.Elasticsearch* ]] && echo \"PID $pid: $cmdline\"; done | wc -l";
189190
// The length of the command exceeds what we can use for COLUMNS so we use a pipe to detect the process we're looking for
190-
psOutput = dockerShell.run("bash -c 'ps -ax | grep org.elasticsearch.bootstrap.Elasticsearch | grep -v grep | wc -l'")
191-
.stdout();
191+
psOutput = dockerShell.run("bash -c '" + detectCommand + "'").stdout();
192+
// System.out.println("psOutput = " + psOutput);
193+
// psOutput = dockerShell.run(
194+
// "bash -c 'COLUMNS=4000 ps w | grep org.elasticsearch.bootstrap.Elasticsearch | grep -v grep | wc -l'"
195+
// ).stdout();
192196
if (psOutput.contains("1")) {
193197
isElasticsearchRunning = true;
194198
break;

0 commit comments

Comments
 (0)