pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mme...@apache.org
Subject [incubator-pulsar] branch master updated: Make supervisord wait a single command (#1866)
Date Fri, 01 Jun 2018 14:56:08 GMT
This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 075e872  Make supervisord wait a single command (#1866)
075e872 is described below

commit 075e87295db70a47fad6dd6097b9ec2f9f0ea283
Author: Ivan Kelly <ivank@apache.org>
AuthorDate: Fri Jun 1 16:56:05 2018 +0200

    Make supervisord wait a single command (#1866)
    
    The integration tests wait for supervisord to be up before attempting
    to start the brokers and proxies. Previously we were doing this by
    checking for the existence of the supervisord socket
    repeatedly. However, this spams the log.
    
    This patch replaces the loop with a single bash command (a bash loop),
    with the timeout built into the command.
    
    Failure of the socket to appear also throws a exception (timeout
    exits with 124), rather than returning a boolean which we were not
    checking previously anyhow.
---
 .../org/apache/pulsar/tests/PulsarClusterUtils.java | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/tests/integration-tests-utils/src/main/java/org/apache/pulsar/tests/PulsarClusterUtils.java
b/tests/integration-tests-utils/src/main/java/org/apache/pulsar/tests/PulsarClusterUtils.java
index ca8e33b..e519760 100644
--- a/tests/integration-tests-utils/src/main/java/org/apache/pulsar/tests/PulsarClusterUtils.java
+++ b/tests/integration-tests-utils/src/main/java/org/apache/pulsar/tests/PulsarClusterUtils.java
@@ -200,24 +200,9 @@ public class PulsarClusterUtils {
             .reduce(true, (accum, res) -> accum && res);
     }
 
-    public static boolean waitSupervisord(DockerClient docker, String containerId) {
-        int i = 50;
-        while (i > 0) {
-            try {
-                DockerUtils.runCommand(docker, containerId, "test", "-S", "/var/run/supervisor/supervisor.sock");
-                return true;
-            } catch (Exception e) {
-                // supervisord not running
-            }
-            try {
-                Thread.sleep(100);
-                i++;
-            } catch (InterruptedException ie) {
-                Thread.currentThread().interrupt();
-                break;
-            }
-        }
-        return false;
+    public static void waitSupervisord(DockerClient docker, String containerId) {
+        DockerUtils.runCommand(docker, containerId, "timeout", "60", "bash", "-c",
+                               "until test -S /var/run/supervisor/supervisor.sock; do sleep
0.1; done");
     }
 
     public static boolean startAllBrokers(DockerClient docker, String cluster) {

-- 
To stop receiving notification emails like this one, please contact
mmerli@apache.org.

Mime
View raw message