BewareMyPower commented on code in PR #456:
URL: https://github.com/apache/pulsar-client-cpp/pull/456#discussion_r1875315823


##########
tests/ReaderTest.cc:
##########
@@ -37,20 +37,25 @@ using namespace pulsar;
 static std::string serviceUrl = "pulsar://localhost:6650";
 static const std::string adminUrl = "http://localhost:8080/";;
 
-class ReaderTest : public ::testing::TestWithParam<bool> {
+class ReaderTest : public ::testing::TestWithParam<std::tuple<bool, bool>> {
    public:
     void initTopic(std::string topicName) {
         if (isMultiTopic_) {
             // call admin api to make it partitioned
-            std::string url = adminUrl + "admin/v2/persistent/public/default/" 
+ topicName + "/partitions";
+            std::string url = adminUrl + "admin/v2/" + (isNonPersistentTopic ? 
"non-" : "") + "persistent/public/default/" + topicName + "/partitions";
             int res = makePutRequest(url, "5");
             LOG_INFO("res = " << res);
             ASSERT_FALSE(res != 204 && res != 409);
         }
     }
 
    protected:
-    bool isMultiTopic_ = GetParam();
+    std::string fullTopicName(const std::string & topicName) {
+        return (isNonPersistentTopic ? "non-" : "") + 
"persistent://public/default/" + topicName;

Review Comment:
   ```suggestion
           return std::string(isNonPersistentTopic ? "non-" : "") + 
"persistent://public/default/" + topicName;
   ```
   
   Only `std::string` can be used to call `operator+`. Otherwise the build will 
fail with "Invalid operands to binary expression ('const char *' and 'const 
char[29]') "



##########
tests/ReaderTest.cc:
##########
@@ -37,20 +37,25 @@ using namespace pulsar;
 static std::string serviceUrl = "pulsar://localhost:6650";
 static const std::string adminUrl = "http://localhost:8080/";;
 
-class ReaderTest : public ::testing::TestWithParam<bool> {
+class ReaderTest : public ::testing::TestWithParam<std::tuple<bool, bool>> {
    public:
     void initTopic(std::string topicName) {
         if (isMultiTopic_) {
             // call admin api to make it partitioned
-            std::string url = adminUrl + "admin/v2/persistent/public/default/" 
+ topicName + "/partitions";
+            std::string url = adminUrl + "admin/v2/" + (isNonPersistentTopic ? 
"non-" : "") + "persistent/public/default/" + topicName + "/partitions";
             int res = makePutRequest(url, "5");
             LOG_INFO("res = " << res);
             ASSERT_FALSE(res != 204 && res != 409);
         }
     }
 
    protected:
-    bool isMultiTopic_ = GetParam();
+    std::string fullTopicName(const std::string & topicName) {

Review Comment:
   `testPartitionIndex` uses `TEST` but not `TEST_F` or `TEST_P`. If you're 
going to call this method in those tests, please change `TEST` to `TEST_P`



-- 
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