From d4fbac4108e0ec381b1d9f4be6dcab8782dc277d Mon Sep 17 00:00:00 2001 From: wddhw Date: Fri, 27 Feb 2026 14:48:50 +0800 Subject: [PATCH] modify ut fail Signed-off-by: wddhw --- .../syncer/distributeddb_mock_sync_module_test.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp index 2a7ed22968..e344596de3 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp @@ -386,16 +386,17 @@ void TimeSync001() EXPECT_CALL(*communicator, SendMessage(_, _, _, _)).WillRepeatedly(Return(DB_ERROR)); const int loopCount = 100; const int timeDriverMs = 200; + std::shared_ptr timeSync = std::make_shared(); for (int i = 0; i < loopCount; ++i) { - MockTimeSync timeSync; - EXPECT_EQ(timeSync.Initialize(communicator, metadata, storage, "DEVICES_A", ""), E_OK); - EXPECT_CALL(timeSync, SyncStart).WillRepeatedly(Return(E_OK)); - timeSync.ModifyTimer(timeDriverMs); + EXPECT_EQ(timeSync->Initialize(communicator, metadata, storage, "DEVICES_A", ""), E_OK); + EXPECT_CALL(*timeSync, SyncStart(_, _, _)).WillRepeatedly(Return(E_OK)); + timeSync->ModifyTimer(timeDriverMs); std::this_thread::sleep_for(std::chrono::milliseconds(timeDriverMs)); - timeSync.Close(); + timeSync->Close(); } std::this_thread::sleep_for(std::chrono::seconds(1)); metadata = nullptr; + timeSync = nullptr; delete storage; delete communicator; } -- Gitee