This is an automated email from the ASF dual-hosted git repository. chenhang pushed a commit to branch branch-2.8 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit fa4bf337d44ce596c97b3b85addd1b4456738d44 Author: ZhangJian He <[email protected]> AuthorDate: Sun Sep 26 20:21:41 2021 +0800 fix logger number not correct in tests (#12168) Log placehodlers not correct. Cause some log info is missing or `{}` alone Fix the placeholder, add `{}` or delete `{}` (cherry picked from commit a69611c287da6662452b3e8febcb1c43cef0c1d0) --- .../apache/pulsar/client/TlsProducerConsumerTest.java | 10 +++++----- .../apache/pulsar/broker/web/PulsarWebResource.java | 2 +- .../tests/integration/topologies/PulsarCluster.java | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/bouncy-castle/bcfips-include-test/src/test/java/org/apache/pulsar/client/TlsProducerConsumerTest.java b/bouncy-castle/bcfips-include-test/src/test/java/org/apache/pulsar/client/TlsProducerConsumerTest.java index f7549f8..fe5c0d1 100644 --- a/bouncy-castle/bcfips-include-test/src/test/java/org/apache/pulsar/client/TlsProducerConsumerTest.java +++ b/bouncy-castle/bcfips-include-test/src/test/java/org/apache/pulsar/client/TlsProducerConsumerTest.java @@ -43,7 +43,7 @@ public class TlsProducerConsumerTest extends TlsProducerConsumerBase { log.info("-- Starting {} test --", methodName); final int MESSAGE_SIZE = 16 * 1024 + 1; - log.info("-- message size --", MESSAGE_SIZE); + log.info("-- message size {} --", MESSAGE_SIZE); internalSetUpForClient(true, pulsar.getBrokerServiceUrlTls()); internalSetUpForNamespace(); @@ -77,7 +77,7 @@ public class TlsProducerConsumerTest extends TlsProducerConsumerBase { log.info("-- Starting {} test --", methodName); final int MESSAGE_SIZE = 16 * 1024 + 1; - log.info("-- message size --", MESSAGE_SIZE); + log.info("-- message size {} --", MESSAGE_SIZE); internalSetUpForNamespace(); // Test 1 - Using TLS on binary protocol without sending certs - expect failure @@ -88,7 +88,7 @@ public class TlsProducerConsumerTest extends TlsProducerConsumerBase { Assert.fail("Server should have failed the TLS handshake since client didn't ."); } catch (Exception ex) { // OK - log.info("first test success: without certs set, meet exception {}", ex); + log.info("first test success: without certs set, meet exception ", ex); } // Test 2 - Using TLS on binary protocol - sending certs @@ -107,7 +107,7 @@ public class TlsProducerConsumerTest extends TlsProducerConsumerBase { log.info("-- Starting {} test --", methodName); final int MESSAGE_SIZE = 16 * 1024 + 1; - log.info("-- message size --", MESSAGE_SIZE); + log.info("-- message size {} --", MESSAGE_SIZE); internalSetUpForNamespace(); // Test 1 - Using TLS on https without sending certs - expect failure @@ -118,7 +118,7 @@ public class TlsProducerConsumerTest extends TlsProducerConsumerBase { Assert.fail("Server should have failed the TLS handshake since client didn't ."); } catch (Exception ex) { // OK - log.info("first test success: without certs set, meet exception {}", ex); + log.info("first test success: without certs set, meet exception ", ex); } // Test 2 - Using TLS on https - sending certs diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java index cc23438..b8645c8 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java @@ -931,7 +931,7 @@ public abstract class PulsarWebResource { throw new RestException(Status.FORBIDDEN, "Broker is forbidden to do read-write operations"); } } catch (Exception e) { - log.warn("Unable to fetch read-only policy config {}", POLICIES_READONLY_FLAG_PATH, e); + log.warn("Unable to fetch read-only policy config ", e); throw new RestException(e); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java index 23f5467..611d8bd 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java @@ -647,4 +647,23 @@ public class PulsarCluster { enabled ? "--enable" : "--disable"); } +<<<<<<< HEAD +======= + public void dumpFunctionLogs(String name) { + for (WorkerContainer container : getAlWorkers()) { + log.info("Trying to get function {} logs from container {}", name, container.getContainerName()); + try { + String logFile = "/pulsar/logs/functions/public/default/" + name + "/" + name + "-0.log"; + String logs = container.<String>copyFileFromContainer(logFile, (inputStream) -> { + return IOUtils.toString(inputStream, "utf-8"); + }); + log.info("Function {} logs {}", name, logs); + } catch (com.github.dockerjava.api.exception.NotFoundException notFound) { + log.info("Cannot download {} logs from {} not found exception {}", name, container.getContainerName(), notFound.toString()); + } catch (Throwable err) { + log.info("Cannot download {} logs from {}", name, container.getContainerName(), err); + } + } + } +>>>>>>> a69611c287d (fix logger number not correct in tests (#12168)) }
