regulators: Modify monitorSensors() to use Services
Modify the monitorSensors() method in the System, Chassis, Device, and
Rail classes to have a new first parameter: Services& services.
Modify SensorMonitoring::execute() to log messages using the new
Journal interface.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I05820cfa94bc3d15dee7a1714a3d253720aa7f92
diff --git a/phosphor-regulators/test/system_tests.cpp b/phosphor-regulators/test/system_tests.cpp
index 7adc5d8..5d1d720 100644
--- a/phosphor-regulators/test/system_tests.cpp
+++ b/phosphor-regulators/test/system_tests.cpp
@@ -16,7 +16,6 @@
#include "chassis.hpp"
#include "device.hpp"
#include "id_map.hpp"
-#include "journal.hpp"
#include "mock_journal.hpp"
#include "mock_services.hpp"
#include "mocked_i2c_interface.hpp"
@@ -201,6 +200,12 @@
TEST(SystemTests, MonitorSensors)
{
+ // Create mock services. No logging should occur.
+ MockServices services{};
+ MockJournal& journal = services.getMockJournal();
+ EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
+ EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
+
// Create PMBusReadSensorAction
pmbus_utils::SensorValueType type{pmbus_utils::SensorValueType::iout};
uint8_t command = 0x8C;
@@ -252,8 +257,5 @@
System system{std::move(rules), std::move(chassisVec)};
// Call monitorSensors()
- journal::clear();
- system.monitorSensors();
- EXPECT_EQ(journal::getDebugMessages().size(), 0);
- EXPECT_EQ(journal::getErrMessages().size(), 0);
+ system.monitorSensors(services);
}