Verify reading parameters on update
Adds verification of ReadingParameter's metric count when property is
being updated. This brings consistency with behavior upon adding a new
report, where that same check is being made. Also adds a unit test for
that check.
Tested:
On platform, by updating report's ReadingParameter with object
containing metric count exceeding one specified by
`max-reading-parameters` project option. With this change applied, that
operation failed, as expected.
Change-Id: I06c8e21178d6bd554b62886e0e4f8cd0589f0d09
Signed-off-by: Michal Orzel <michalx.orzel@intel.com>
diff --git a/src/report.cpp b/src/report.cpp
index fa1da3f..c9df1e2 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -290,6 +290,7 @@
sdbusplus::vtable::property_::emits_change,
[this, &reportFactory](auto newVal, auto& oldVal) {
auto labeledMetricParams = reportFactory.convertMetricParams(newVal);
+ ReportManager::verifyMetricParams(labeledMetricParams);
reportFactory.updateMetrics(metrics, state.get<ReportFlags::enabled>(),
labeledMetricParams);
readingParameters = toReadingParameters(