This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new bbe08b34ba [Bug](be-ut) Fix the timezone dependency in UT (#11148) bbe08b34ba is described below commit bbe08b34ba0869e994e539b0bd0afde3046696af Author: Adonis Ling <adonis0...@gmail.com> AuthorDate: Mon Jul 25 18:15:05 2022 +0800 [Bug](be-ut) Fix the timezone dependency in UT (#11148) --- be/test/olap/timestamped_version_tracker_test.cpp | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/be/test/olap/timestamped_version_tracker_test.cpp b/be/test/olap/timestamped_version_tracker_test.cpp index 0710134127..4ca1013c40 100644 --- a/be/test/olap/timestamped_version_tracker_test.cpp +++ b/be/test/olap/timestamped_version_tracker_test.cpp @@ -23,8 +23,6 @@ #include <sstream> #include "gutil/strings/substitute.h" -#include "json2pb/json_to_pb.h" -#include "olap/olap_meta.h" #include "olap/rowset/rowset_meta.h" #include "olap/version_graph.h" @@ -34,8 +32,7 @@ using RowsetMetaSharedContainerPtr = std::shared_ptr<std::vector<RowsetMetaShare class TestTimestampedVersionTracker : public testing::Test { public: - TestTimestampedVersionTracker() {} - void SetUp() { + void SetUp() override { _json_rowset_meta = R"({ "rowset_id": 540081, "tablet_id": 15673, @@ -111,7 +108,7 @@ public: } })"; } - void TearDown() {} + void TearDown() override {} void init_rs_meta(RowsetMetaSharedPtr& pb1, int64_t start, int64_t end) { pb1->init_from_json(_json_rowset_meta); @@ -768,29 +765,33 @@ TEST_F(TestTimestampedVersionTracker, get_stale_version_path_json_doc) { path_arr.Accept(writer); std::string json_result = std::string(strbuf.GetString()); - auto time_zone = cctz::local_time_zone(); - auto tp = std::chrono::system_clock::now(); - auto time_zone_str = cctz::format("%z", tp, time_zone); + std::string datetime_format = "%Y-%m-%d %H:%M:%S"; + cctz::time_zone time_zone; + cctz::load_time_zone("Asia/Shanghai", &time_zone); + std::chrono::system_clock::time_point tp; + cctz::parse(datetime_format, "1970-01-01 10:46:40", time_zone, &tp); + auto time_zone_str = + cctz::format(fmt::format("{} %z", datetime_format), tp, cctz::local_time_zone()); std::string expect_result = R"([ { "path id": "1", - "last create time": "1970-01-01 10:46:40 $0", + "last create time": "$0", "path list": "1 -> [2-3] -> [4-5]" }, { "path id": "2", - "last create time": "1970-01-01 10:46:40 $0", + "last create time": "$0", "path list": "2 -> [6-6] -> [7-8]" }, { "path id": "3", - "last create time": "1970-01-01 10:46:40 $0", + "last create time": "$0", "path list": "3 -> [6-8] -> [9-9]" }, { "path id": "4", - "last create time": "1970-01-01 10:46:40 $0", + "last create time": "$0", "path list": "4 -> [10-10]" } ])"; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org