merlimat commented on code in PR #15924:
URL: https://github.com/apache/pulsar/pull/15924#discussion_r889205621


##########
pulsar-client-cpp/tests/AuthPluginTest.cc:
##########
@@ -226,7 +228,8 @@ void mockZTS(int port) {
 }  // namespace testAthenz
 
 TEST(AuthPluginTest, testAthenz) {
-    std::thread zts(std::bind(&testAthenz::mockZTS, 9999));
+    Latch latch(1);
+    std::thread zts(std::bind(&testAthenz::mockZTS, &latch, 9999));

Review Comment:
   ```suggestion
       std::thread zts(std::bind(&testAthenz::mockZTS, std::ref(latch), 9999));
   ```



##########
pulsar-client-cpp/tests/AuthPluginTest.cc:
##########
@@ -190,14 +191,15 @@ TEST(AuthPluginTest, 
testTlsDetectHttpsWithHostNameValidation) {
 
 namespace testAthenz {
 std::string principalToken;
-void mockZTS(int port) {
+void mockZTS(Latch* latch, int port) {

Review Comment:
   Passing pointers around can result ambiguous on on the ownership of the 
object. We should use a reference instead: 
   ```suggestion
   void mockZTS(Latch& latch, int port) {
   ```
   



##########
pulsar-client-cpp/tests/AuthPluginTest.cc:
##########
@@ -296,7 +300,8 @@ TEST(AuthPluginTest, testAuthFactoryTls) {
 }
 
 TEST(AuthPluginTest, testAuthFactoryAthenz) {
-    std::thread zts(std::bind(&testAthenz::mockZTS, 9998));
+    Latch latch(1);
+    std::thread zts(std::bind(&testAthenz::mockZTS, &latch, 9998));

Review Comment:
   ```suggestion
       std::thread zts(std::bind(&testAthenz::mockZTS, std::ref(latch), 9998));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to