merlimat closed pull request #1802: Utilities to update configuration for 
integration tests
URL: https://github.com/apache/incubator-pulsar/pull/1802
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 984dadc1d9..ca8e33b0d7 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
@@ -169,7 +169,7 @@ public static boolean waitBrokerUp(DockerClient docker, 
String containerId,
                     return true;
                 } catch (Exception e) {
                     // couldn't connect, try again after sleep
-                    LOG.info("Failed to connect {} @ {}", ip, BROKER_PORT, e);
+                    LOG.debug("Failed to connect {} @ {}", ip, BROKER_PORT, e);
                 }
                 try {
                     Thread.sleep(pollMillis);
@@ -295,4 +295,27 @@ public static void stopAllProxies(DockerClient docker, 
String cluster) {
         return DockerUtils.cubeIdsWithLabels(docker, 
ImmutableMap.of("service", "zookeeper",
                                                                      
"cluster", cluster));
     }
+
+    public static void updateConf(DockerClient docker, String containerId,
+                                  String confFile, String key, String value) 
throws Exception {
+        String sedProgram = String.format(
+                "/[[:blank:]]*%s[[:blank:]]*=/ { h; s^=.*^=%s^; }; ${x;/^$/ { 
s^^%s=%s^;H; }; x}",
+                key, value, key, value);
+        DockerUtils.runCommand(docker, containerId, "sed", "-i", "-e", 
sedProgram, confFile);
+    }
+
+    public static void setLogLevel(DockerClient docker, String containerId,
+                                   String loggerName, String level) throws 
Exception {
+        String sedProgram = String.format(
+                "/  Logger:/ a\\\n"
+                +"      - name: %s\\n"
+                +"        level: %s\\n"
+                +"        additivity: false\\n"
+                +"        AppenderRef:\\n"
+                +"          - ref: Console\\n"
+                +"          - level: debug\\n",
+                loggerName, level);
+        String logConf = "/pulsar/conf/log4j2.yaml";
+        DockerUtils.runCommand(docker, containerId, "sed", "-i", "-e", 
sedProgram, logConf);
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to