Fix CI error
The test case doUpdateOnePSUNotPresent() recently started failing in CI
on the meson pass that contains the following option:
* -Db_sanitize=address,undefined
This option turns on memory checking, and that results in slightly
different gtest execution.
There appears to be one or more gmock bugs when ON_CALL and EXPECT_CALL
are used on the same mock method. Modify doUpdateOnePSUNotPresent() to
use ON_CALL instead of EXPECT_CALL. This is consistent with the other
methods in this file.
Also wrap the SdBusMock objects in test cases with NiceMock<> to
simplify future test case debug. The test cases do not set many
expectations on the sdbusplus functions that are called, and this
results in a huge number of 'Uninteresting mock function call' warning
messages. Using NiceMock eliminates these warnings.
Tested:
* Verified all automated test cases pass
Change-Id: I9f7ef8f314378ad928579c3b5707aab4fa091a23
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/test/test_item_updater.cpp b/test/test_item_updater.cpp
index 4f9af37..6c96d84 100644
--- a/test/test_item_updater.cpp
+++ b/test/test_item_updater.cpp
@@ -9,6 +9,7 @@
using namespace phosphor::software::updater;
using ::testing::_;
using ::testing::ContainerEq;
+using ::testing::NiceMock;
using ::testing::Pointee;
using ::testing::Return;
using ::testing::ReturnArg;
@@ -63,7 +64,7 @@
}
static constexpr auto dBusPath = SOFTWARE_OBJPATH;
- sdbusplus::SdBusMock sdbusMock;
+ NiceMock<sdbusplus::SdBusMock> sdbusMock;
sdbusplus::bus_t mockedBus = sdbusplus::get_mocked_new(&sdbusMock);
const utils::MockedUtils& mockedUtils;
std::unique_ptr<ItemUpdater> itemUpdater;