From 1fcccd62ac9566f3506fad2e2abd3debd54918ee Mon Sep 17 00:00:00 2001 From: Jia Zhai Date: Tue, 25 Feb 2020 04:02:43 +0800 Subject: [PATCH] Fix broker client tls settings error (#6128) when broker create the inside client, it sets tlsTrustCertsFilePath as "getTlsCertificateFilePath()", but it should be "getBrokerClientTrustCertsFilePath()" --- .../main/java/org/apache/pulsar/broker/PulsarService.java | 8 ++++++++ pulsar-client-cpp/python/pulsar_test.py | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java index fe848b5e8b466..31b7fa391f245 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java @@ -910,6 +910,14 @@ public synchronized PulsarClient getClient() throws PulsarServerException { .enableTls(this.getConfiguration().isTlsEnabled()) .allowTlsInsecureConnection(this.getConfiguration().isTlsAllowInsecureConnection()) .tlsTrustCertsFilePath(this.getConfiguration().getTlsCertificateFilePath()); + + if (this.getConfiguration().isBrokerClientTlsEnabled()) { + builder.tlsTrustCertsFilePath( + isNotBlank(this.getConfiguration().getBrokerClientTrustCertsFilePath()) + ? this.getConfiguration().getBrokerClientTrustCertsFilePath() + : this.getConfiguration().getTlsCertificateFilePath()); + } + if (isNotBlank(this.getConfiguration().getBrokerClientAuthenticationPlugin())) { builder.authentication(this.getConfiguration().getBrokerClientAuthenticationPlugin(), this.getConfiguration().getBrokerClientAuthenticationParameters()); diff --git a/pulsar-client-cpp/python/pulsar_test.py b/pulsar-client-cpp/python/pulsar_test.py index 14cf2938bc554..4109ec79eeaa2 100755 --- a/pulsar-client-cpp/python/pulsar_test.py +++ b/pulsar-client-cpp/python/pulsar_test.py @@ -152,7 +152,7 @@ def test_redelivery_count(self): producer.send(b'hello') redelivery_count = 0 - for i in range(4): + for i in range(4): msg = consumer.receive(TM) print("Received message %s" % msg.data()) consumer.negative_acknowledge(msg) @@ -668,13 +668,13 @@ def test_publish_compact_and_consume(self): while True: s=doHttpGet(url).decode('utf-8') if 'RUNNING' in s: - print("Compact still running") print(s) + print("Compact still running") time.sleep(0.2) else: - self.assertTrue('SUCCESS' in s) - print("Compact Complete now") print(s) + print("Compact Complete now") + self.assertTrue('SUCCESS' in s) break # after compaction completes the compacted ledger is recorded