You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2022/09/07 16:00:34 UTC

[GitHub] [incubator-pegasus] acelyc111 opened a new pull request, #1149: refactor(CI): enable and parallelize function test

acelyc111 opened a new pull request, #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149

   https://github.com/apache/incubator-pegasus/issues/1053
   
   The 'function test' in Pegasus is used to test some complex functions of Pegasus, it's some type of integreation test, however, it will last a very long time, say, dozens of minutes, so we disabled it in GitHub CI to save time.
   This patch enable the function tests and parallelize them, which will save much time. Running function test regularlly can keep the system stablility.


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] empiredan commented on a diff in pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
empiredan commented on code in PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149#discussion_r964629658


##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;
-        compare(it1->second, it2->second, hash_key, it1->first);
+        ASSERT_NO_FATAL_FAILURE(compare(it1->second, it2->second, hash_key, it1->first));
     }
-
-    dinfo("Data and base are the same.");
 }
 
-inline void compare(const std::map<std::string, std::string> &data,
-                    const std::map<std::string, std::string> &base,
+inline void compare(const std::map<std::string, std::string> &expect,
+                    const std::map<std::string, std::string> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << hash_key
-                                       << ", sort_key=" << it2->first << ", value=" << it2->second;
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << hash_key
+                                         << ", sort_key=" << it2->first
+                                         << ", value=" << it2->second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second;
-        ASSERT_EQ(*it2, *it1) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << hash_key
+                                     << ", sort_key=" << it1->first << ", value=" << it1->second;
+        ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
                               << ", data_value=" << it1->second << ", base_sort_key=" << it2->first
                               << ", base_value=" << it2->second;
     }
-
-    dinfo("Data and base are the same.");
 }
 
 template <typename T, typename U>
-inline void compare(const T &data, const U &base)
+inline void compare(const T &expect, const U &actual)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << it2->first;
+    ASSERT_EQ(expect.size(), actual.size());
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << it2->first;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << it1->first;
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << it1->first;
         ASSERT_EQ(it1->first, it2->first) << "Diff: data_hash_key=" << it1->first

Review Comment:
   ```suggestion
           ASSERT_EQ(it1->first, it2->first) << "Diff: actual_hash_key=" << it1->first
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;
-        compare(it1->second, it2->second, hash_key, it1->first);
+        ASSERT_NO_FATAL_FAILURE(compare(it1->second, it2->second, hash_key, it1->first));
     }
-
-    dinfo("Data and base are the same.");
 }
 
-inline void compare(const std::map<std::string, std::string> &data,
-                    const std::map<std::string, std::string> &base,
+inline void compare(const std::map<std::string, std::string> &expect,
+                    const std::map<std::string, std::string> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << hash_key
-                                       << ", sort_key=" << it2->first << ", value=" << it2->second;
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << hash_key
+                                         << ", sort_key=" << it2->first
+                                         << ", value=" << it2->second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second;
-        ASSERT_EQ(*it2, *it1) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << hash_key
+                                     << ", sort_key=" << it1->first << ", value=" << it1->second;
+        ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
                               << ", data_value=" << it1->second << ", base_sort_key=" << it2->first
                               << ", base_value=" << it2->second;

Review Comment:
   ```suggestion
                                 << ", expected_value=" << it2->second;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;
-        compare(it1->second, it2->second, hash_key, it1->first);
+        ASSERT_NO_FATAL_FAILURE(compare(it1->second, it2->second, hash_key, it1->first));
     }
-
-    dinfo("Data and base are the same.");
 }
 
-inline void compare(const std::map<std::string, std::string> &data,
-                    const std::map<std::string, std::string> &base,
+inline void compare(const std::map<std::string, std::string> &expect,
+                    const std::map<std::string, std::string> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << hash_key
-                                       << ", sort_key=" << it2->first << ", value=" << it2->second;
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << hash_key
+                                         << ", sort_key=" << it2->first
+                                         << ", value=" << it2->second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second;
-        ASSERT_EQ(*it2, *it1) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << hash_key
+                                     << ", sort_key=" << it1->first << ", value=" << it1->second;
+        ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first

Review Comment:
   ```suggestion
           ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", actual_sort_key=" << it1->first
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;

Review Comment:
   ```suggestion
           << ", actual_value=" << actual.first << ", actual_expire_ts_seconds=" << actual.second;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first

Review Comment:
   ```suggestion
               << ", actual_expire_ts_seconds=" << it1->second.second << ", expected_sort_key=" << it2->first
   ```



##########
src/test/function_test/utils/test_util.h:
##########
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+#pragma once
+
+#include <memory>
+
+#include <gtest/gtest.h>
+
+namespace dsn {
+namespace replication {
+class replication_ddl_client;
+} // namespace replication
+} // namespace dsn
+
+namespace pegasus {
+class pegasus_client;
+
+class test_util : public ::testing::Test
+{
+public:
+    test_util();
+    virtual ~test_util();
+
+    static void SetUpTestCase();
+
+    void SetUp() override;
+
+protected:
+    std::string cluster_name_;
+    std::string app_name_;
+    pegasus_client *client = nullptr;

Review Comment:
   ```suggestion
       std::string _cluster_name;
       std::string _app_name;
       pegasus_client *_client = nullptr;
   ```



##########
src/test/function_test/utils/CMakeLists.txt:
##########
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set(MY_PROJ_NAME "function_test_utils")
+set(MY_SRC_SEARCH_MODE "GLOB")
+set(MY_PROJ_SRC "")
+set(MY_PROJ_LIBS
+        dsn_client
+        dsn_replication_common
+        pegasus_client_static
+        gtest
+        )

Review Comment:
   ```suggestion
   set(MY_PROJ_LIBS
       dsn_client
       dsn_replication_common
       pegasus_client_static
       gtest
       )
   ```



##########
src/test/function_test/partition_split_test/test_split.cpp:
##########
@@ -229,132 +217,114 @@ class partition_split_test : public testing::Test
     std::unordered_map<std::string, std::unordered_map<std::string, std::string>> expected;
     const int32_t partition_count = 4;
     const int32_t dataset_count = 1000;
+    const std::string _table_name_prefix = "split_table_test_";
+    std::string _table_name;

Review Comment:
   ```suggestion
       const std::string table_name_prefix = "split_table_test_";
       std::string table_name;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;

Review Comment:
   ```suggestion
           << ", actual_value=" << actual.first << ", actual_expire_ts_seconds=" << actual.second;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first

Review Comment:
   ```suggestion
               << ", actual_value=" << it1->second.first
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first

Review Comment:
   ```suggestion
               << ", expected_value=" << it2->second.first
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;
-        compare(it1->second, it2->second, hash_key, it1->first);
+        ASSERT_NO_FATAL_FAILURE(compare(it1->second, it2->second, hash_key, it1->first));
     }
-
-    dinfo("Data and base are the same.");
 }
 
-inline void compare(const std::map<std::string, std::string> &data,
-                    const std::map<std::string, std::string> &base,
+inline void compare(const std::map<std::string, std::string> &expect,
+                    const std::map<std::string, std::string> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << hash_key
-                                       << ", sort_key=" << it2->first << ", value=" << it2->second;
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << hash_key
+                                         << ", sort_key=" << it2->first
+                                         << ", value=" << it2->second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second;
-        ASSERT_EQ(*it2, *it1) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << hash_key
+                                     << ", sort_key=" << it1->first << ", value=" << it1->second;
+        ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
                               << ", data_value=" << it1->second << ", base_sort_key=" << it2->first
                               << ", base_value=" << it2->second;
     }
-
-    dinfo("Data and base are the same.");
 }
 
 template <typename T, typename U>
-inline void compare(const T &data, const U &base)
+inline void compare(const T &expect, const U &actual)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << it2->first;
+    ASSERT_EQ(expect.size(), actual.size());
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << it2->first;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << it1->first;
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << it1->first;
         ASSERT_EQ(it1->first, it2->first) << "Diff: data_hash_key=" << it1->first
                                           << ", base_hash_key=" << it2->first;

Review Comment:
   ```suggestion
                                             << ", expected_hash_key=" << it2->first;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;
-        compare(it1->second, it2->second, hash_key, it1->first);
+        ASSERT_NO_FATAL_FAILURE(compare(it1->second, it2->second, hash_key, it1->first));
     }
-
-    dinfo("Data and base are the same.");
 }
 
-inline void compare(const std::map<std::string, std::string> &data,
-                    const std::map<std::string, std::string> &base,
+inline void compare(const std::map<std::string, std::string> &expect,
+                    const std::map<std::string, std::string> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2) << "Only in base: hash_key=" << hash_key
-                                       << ", sort_key=" << it2->first << ", value=" << it2->second;
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2) << "Only in expect: hash_key=" << hash_key
+                                         << ", sort_key=" << it2->first
+                                         << ", value=" << it2->second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second;
-        ASSERT_EQ(*it2, *it1) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
+        ASSERT_NE(expect.end(), it2) << "Only in actual: hash_key=" << hash_key
+                                     << ", sort_key=" << it1->first << ", value=" << it1->second;
+        ASSERT_EQ(*it1, *it2) << "Diff: hash_key=" << hash_key << ", data_sort_key=" << it1->first
                               << ", data_value=" << it1->second << ", base_sort_key=" << it2->first

Review Comment:
   ```suggestion
                                 << ", actual_value=" << it1->second << ", expected_sort_key=" << it2->first
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second

Review Comment:
   ```suggestion
           << ", expected_value=" << expect.first << ", expected_expire_ts_seconds=" << expect.second
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second

Review Comment:
   ```suggestion
           << ", expected_value=" << expect.first << ", expected_expire_ts_seconds=" << expect.second
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first
             << ", data_value=" << it1->second.first
             << ", data_expire_ts_seconds=" << it1->second.second << ", base_sort_key=" << it2->first
             << ", base_value=" << it2->second.first
             << ", base_expire_ts_seconds=" << it2->second.second;

Review Comment:
   ```suggestion
               << ", expected_expire_ts_seconds=" << it2->second.second;
   ```



##########
src/test/function_test/utils/utils.h:
##########
@@ -126,81 +126,77 @@ inline void check_and_put(std::map<std::string, std::string> &data,
     data[sort_key] = value;
 }
 
-inline void compare(const std::pair<std::string, uint32_t> &data,
-                    const std::pair<std::string, uint32_t> &base,
+inline void compare(const std::pair<std::string, uint32_t> &expect,
+                    const std::pair<std::string, uint32_t> &actual,
                     const std::string &hash_key,
                     const std::string sort_key)
 {
-    ASSERT_EQ(base.first, data.first)
+    ASSERT_EQ(expect.first, actual.first)
         << "Diff value: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 
-    ASSERT_TRUE(data.second >= base.second && data.second - base.second <= 1)
+    ASSERT_TRUE(expect.second >= actual.second && expect.second - actual.second <= 1)
         << "Diff expire_ts_seconds: hash_key=" << hash_key << ", sort_key=" << sort_key
-        << ", data_value=" << data.first << ", data_expire_ts_seconds=" << data.second
-        << ", base_value=" << base.first << ", base_expire_ts_seconds=" << base.second;
+        << ", data_value=" << expect.first << ", data_expire_ts_seconds=" << expect.second
+        << ", base_value=" << actual.first << ", base_expire_ts_seconds=" << actual.second;
 }
 
-inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &data,
-                    const std::map<std::string, std::pair<std::string, uint32_t>> &base,
+inline void compare(const std::map<std::string, std::pair<std::string, uint32_t>> &expect,
+                    const std::map<std::string, std::pair<std::string, uint32_t>> &actual,
                     const std::string &hash_key)
 {
-    for (auto it1 = data.begin(), it2 = base.begin();; ++it1, ++it2) {
-        if (it1 == data.end()) {
-            ASSERT_EQ(base.end(), it2)
-                << "Only in base: hash_key=" << hash_key << ", sort_key=" << it2->first
+    for (auto it1 = actual.begin(), it2 = expect.begin();; ++it1, ++it2) {
+        if (it1 == actual.end()) {
+            ASSERT_EQ(expect.end(), it2)
+                << "Only in expect: hash_key=" << hash_key << ", sort_key=" << it2->first
                 << ", value=" << it2->second.first << ", expire_ts_seconds=" << it2->second.second;
             break;
         }
-        ASSERT_NE(base.end(), it2) << "Only in data: hash_key=" << hash_key
-                                   << ", sort_key=" << it1->first << ", value=" << it1->second.first
-                                   << ", expire_ts_seconds=" << it1->second.second;
-        ASSERT_EQ(it2->first, it1->first)
+        ASSERT_NE(expect.end(), it2)
+            << "Only in actual: hash_key=" << hash_key << ", sort_key=" << it1->first
+            << ", value=" << it1->second.first << ", expire_ts_seconds=" << it1->second.second;
+        ASSERT_EQ(it1->first, it2->first)
             << "Diff sort_key: hash_key=" << hash_key << ", data_sort_key=" << it1->first

Review Comment:
   ```suggestion
               << "Diff sort_key: hash_key=" << hash_key << ", actual_sort_key=" << it1->first
   ```



##########
src/server/config.ini:
##########
@@ -395,7 +395,7 @@
   prometheus_port = 9091
 
 [pegasus.collector]
-  available_detect_app = temp
+  available_detect_app = stat

Review Comment:
   Do we need add `replication.app` in config.ini by which `meta_server` will create the tables as default ? Otherwise collector will report error once started since the table does not exist.
   ```
   [replication.app]
   app_name = stat
   app_type = pegasus
   partition_count = 8
   max_replica_count = 3
   stateful = true
   ```



##########
src/test/function_test/partition_split_test/test_split.cpp:
##########
@@ -229,132 +217,114 @@ class partition_split_test : public testing::Test
     std::unordered_map<std::string, std::unordered_map<std::string, std::string>> expected;
     const int32_t partition_count = 4;
     const int32_t dataset_count = 1000;
+    const std::string _table_name_prefix = "split_table_test_";
+    std::string _table_name;
     const std::string dataset_hashkey_prefix = "hashkey";
     const std::string dataset_sortkey_prefix = "sortkey";
     const std::string splitting_hashkey_prefix = "keyh_";
     const std::string splitting_sortkey_prefix = "keys_";
     const std::string data_value = "vaule";
     int32_t count_during_split = 0;
+    static int32_t test_case_;

Review Comment:
   ```suggestion
       static int32_t test_case;
   ```



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 commented on code in PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149#discussion_r964901328


##########
src/test/function_test/utils/test_util.h:
##########
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+#pragma once
+
+#include <memory>
+
+#include <gtest/gtest.h>
+
+namespace dsn {
+namespace replication {
+class replication_ddl_client;
+} // namespace replication
+} // namespace dsn
+
+namespace pegasus {
+class pegasus_client;
+
+class test_util : public ::testing::Test
+{
+public:
+    test_util();
+    virtual ~test_util();
+
+    static void SetUpTestCase();
+
+    void SetUp() override;
+
+protected:
+    std::string cluster_name_;
+    std::string app_name_;
+    pegasus_client *client = nullptr;

Review Comment:
   Sure, but when I ever tried to rename `client` to some other name, the git didn't work well that consider the file I modified to be deleted old file and added a new one, which will cause the git history lost. So I plan to rename it in another patch.



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 closed pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 closed pull request #1149: refactor(CI): enable and parallelize function test
URL: https://github.com/apache/incubator-pegasus/pull/1149


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 merged pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 merged PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 commented on code in PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149#discussion_r964906027


##########
src/test/function_test/utils/test_util.h:
##########
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+#pragma once
+
+#include <memory>
+
+#include <gtest/gtest.h>
+
+namespace dsn {
+namespace replication {
+class replication_ddl_client;
+} // namespace replication
+} // namespace dsn
+
+namespace pegasus {
+class pegasus_client;
+
+class test_util : public ::testing::Test
+{
+public:
+    test_util();
+    virtual ~test_util();
+
+    static void SetUpTestCase();
+
+    void SetUp() override;
+
+protected:
+    std::string cluster_name_;
+    std::string app_name_;
+    pegasus_client *client = nullptr;

Review Comment:
   There is some controversy that whether the underscore is at the start or at the end, for the google code style guide for Cpp [1], it is at the end. For the new added files, we can keep it at the end, and when we plan to refactor old code, we can update them to the end.
   
   1. https://google.github.io/styleguide/cppguide.html#Variable_Names



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 commented on code in PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149#discussion_r964922453


##########
src/server/config.ini:
##########
@@ -395,7 +395,7 @@
   prometheus_port = 9091
 
 [pegasus.collector]
-  available_detect_app = temp
+  available_detect_app = stat

Review Comment:
   It make sense, however, table `stat` is used everywhere currently, we can do it later.
   Track it in https://github.com/apache/incubator-pegasus/issues/1151



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1149: refactor(CI): enable and parallelize function test

Posted by GitBox <gi...@apache.org>.
acelyc111 commented on code in PR #1149:
URL: https://github.com/apache/incubator-pegasus/pull/1149#discussion_r964901328


##########
src/test/function_test/utils/test_util.h:
##########
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+#pragma once
+
+#include <memory>
+
+#include <gtest/gtest.h>
+
+namespace dsn {
+namespace replication {
+class replication_ddl_client;
+} // namespace replication
+} // namespace dsn
+
+namespace pegasus {
+class pegasus_client;
+
+class test_util : public ::testing::Test
+{
+public:
+    test_util();
+    virtual ~test_util();
+
+    static void SetUpTestCase();
+
+    void SetUp() override;
+
+protected:
+    std::string cluster_name_;
+    std::string app_name_;
+    pegasus_client *client = nullptr;

Review Comment:
   Sure, but when I ever tried to rename `client` to some other name (a large amount of related code have to be updated), the git didn't work well that consider the file I modified to be deleted old file and added a new one, which will cause the git history lost. So I plan to rename it in another patch.



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org