gavinchou commented on code in PR #53417:
URL: https://github.com/apache/doris/pull/53417#discussion_r2223191859


##########
cloud/test/log_test.cpp:
##########
@@ -107,4 +169,86 @@ TEST(LogTest, ThreadTest) {
         ASSERT_EQ(bthread_start_background(&tid, nullptr, fn, nullptr), 0);
         ASSERT_EQ(bthread_join(tid, nullptr), 0);
     }
+}
+
+TEST(LogTest, Variable) {
+    // lvalue mutable
+    {
+        std::string s {"hello"};
+        AnnotateTag tag("s", s);
+        std::stringstream ss;
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " s=\"hello\"");
+        s = "world";
+        ss.str("");
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " s=\"world\"");
+        s = "doris";
+        ss.str("");
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " s=\"doris\"");
+    }
+    {
+        int64_t test_id {};
+        AnnotateTag tag_test_id("test_id", test_id);
+        std::stringstream ss;
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " test_id=0");
+        test_id = 2022;
+        ss.str("");
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " test_id=2022");
+    }
+    // rvalue constant
+    {
+        AnnotateTag tag("log_id", 111111);
+        std::stringstream ss;
+        AnnotateTag::format_tag_list(ss);
+        ASSERT_EQ(ss.str(), " log_id=111111");
+    }
+}
+
+TEST(LogTest, RpcRunningOutput) {

Review Comment:
   run this test in bthread to make it much more real



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to