regulators: Modify Configuration to use Journal
Modify Configuration::execute() to log messages using
the new Journal interface.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: If7dee12ca064147386fc076223474f004281d7ec
diff --git a/phosphor-regulators/test/system_tests.cpp b/phosphor-regulators/test/system_tests.cpp
index daa2084..7adc5d8 100644
--- a/phosphor-regulators/test/system_tests.cpp
+++ b/phosphor-regulators/test/system_tests.cpp
@@ -23,6 +23,7 @@
#include "pmbus_read_sensor_action.hpp"
#include "rail.hpp"
#include "rule.hpp"
+#include "services.hpp"
#include "system.hpp"
#include "test_utils.hpp"
@@ -91,8 +92,13 @@
TEST(SystemTests, Configure)
{
- // Create mock services.
+ // Create mock services. Expect logInfo() to be called.
MockServices services{};
+ MockJournal& journal = services.getMockJournal();
+ EXPECT_CALL(journal, logInfo("Configuring chassis 1")).Times(1);
+ EXPECT_CALL(journal, logInfo("Configuring chassis 3")).Times(1);
+ EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
+ EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
// Specify an empty rules vector
std::vector<std::unique_ptr<Rule>> rules{};
@@ -106,13 +112,7 @@
System system{std::move(rules), std::move(chassis)};
// Call configure()
- journal::clear();
system.configure(services);
- EXPECT_EQ(journal::getDebugMessages().size(), 0);
- EXPECT_EQ(journal::getErrMessages().size(), 0);
- std::vector<std::string> expectedInfoMessages{"Configuring chassis 1",
- "Configuring chassis 3"};
- EXPECT_EQ(journal::getInfoMessages(), expectedInfoMessages);
}
TEST(SystemTests, GetChassis)