From commits-return-22443-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Thu Feb 14 02:29:00 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B37781807A6 for ; Thu, 14 Feb 2019 03:28:58 +0100 (CET) Received: (qmail 22877 invoked by uid 500); 14 Feb 2019 02:28:57 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 22866 invoked by uid 99); 14 Feb 2019 02:28:57 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2019 02:28:57 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 450C782E12; Thu, 14 Feb 2019 02:28:57 +0000 (UTC) Date: Thu, 14 Feb 2019 02:28:57 +0000 To: "commits@pulsar.apache.org" Subject: [pulsar] branch master updated: Fixed race condition in C++ test testTlsDetectPulsarSslWithHostNameValidation (#3593) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155011133695.27790.11298525947229318481@gitbox.apache.org> From: sijie@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: pulsar X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c79fd728cf27417ca117ca220dd07dc4319d4c46 X-Git-Newrev: cecf8e77f66d0ceddf726f09f4b56de2fdf1147a X-Git-Rev: cecf8e77f66d0ceddf726f09f4b56de2fdf1147a X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. sijie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git The following commit(s) were added to refs/heads/master by this push: new cecf8e7 Fixed race condition in C++ test testTlsDetectPulsarSslWithHostNameValidation (#3593) cecf8e7 is described below commit cecf8e77f66d0ceddf726f09f4b56de2fdf1147a Author: Matteo Merli AuthorDate: Wed Feb 13 18:28:52 2019 -0800 Fixed race condition in C++ test testTlsDetectPulsarSslWithHostNameValidation (#3593) ### Motivation Fixed flaky test in `AuthPluginTest.testTlsDetectPulsarSslWithHostNameValidation`. The failure was due to the fact that test is creating a producer asynchronously but not waiting for the future to be completed. --- pulsar-client-cpp/tests/AuthPluginTest.cc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/pulsar-client-cpp/tests/AuthPluginTest.cc b/pulsar-client-cpp/tests/AuthPluginTest.cc index 86a6acb..8e43ebc 100644 --- a/pulsar-client-cpp/tests/AuthPluginTest.cc +++ b/pulsar-client-cpp/tests/AuthPluginTest.cc @@ -140,24 +140,18 @@ TEST(AuthPluginTest, testTlsDetectPulsarSsl) { } TEST(AuthPluginTest, testTlsDetectPulsarSslWithHostNameValidation) { - try { - ClientConfiguration config = ClientConfiguration(); - config.setTlsTrustCertsFilePath(caPath); - config.setTlsAllowInsecureConnection(false); - config.setAuth(pulsar::AuthTls::create(clientPublicKeyPath, clientPrivateKeyPath)); - config.setValidateHostName(true); + ClientConfiguration config = ClientConfiguration(); + config.setTlsTrustCertsFilePath(caPath); + config.setTlsAllowInsecureConnection(false); + config.setValidateHostName(true); + config.setAuth(pulsar::AuthTls::create(clientPublicKeyPath, clientPrivateKeyPath)); - Client client(serviceUrlTls, config); - std::string topicName = "persistent://private/auth/test-tls-detect"; + Client client(serviceUrlTls, config); + std::string topicName = "persistent://private/auth/testTlsDetectPulsarSslWithHostNameValidation"; - Producer producer; - Promise producerPromise; - client.createProducerAsync(topicName, WaitForCallbackValue(producerPromise)); - } catch (const std::exception& ex) { - EXPECT_EQ(ex.what(), std::string("handshake: certificate verify failed")); - } catch (...) { - FAIL() << "Expected handshake: certificate verify failed"; - } + Producer producer; + Result res = client.createProducer(topicName, producer); + ASSERT_EQ(ResultConnectError, res); } TEST(AuthPluginTest, testTlsDetectHttps) {