Fixed handling maxAppendLimit
maxLimit prevented using numeric_limits<uint64_t>::max as a way to let
telemetry service deduce appendLimit. This commit fixes constrain to
allow passing this special value.
Tested:
- Added new unit tests that confirm numeric_limits<uint64_t>::max is
correctly handled in telemetry service
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I5d67e83475cdfcbb58a71b783ac9eef1e5ad7010
diff --git a/tests/src/test_report_manager.cpp b/tests/src/test_report_manager.cpp
index 9af5c57..a18579c 100644
--- a/tests/src/test_report_manager.cpp
+++ b/tests/src/test_report_manager.cpp
@@ -279,6 +279,19 @@
EXPECT_THAT(path, Eq(std::string()));
}
+TEST_F(TestReportManager, addReportWithAppendLimitEqualToUint64MaxIsAllowed)
+{
+ reportParams.appendLimit(std::numeric_limits<uint64_t>::max());
+
+ EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
+ reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
+ .WillOnce(Return(ByMove(std::move(reportMockPtr))));
+
+ auto [ec, path] = addReport(reportParams);
+ EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
+ EXPECT_THAT(path, Eq(reportMock.getPath()));
+}
+
TEST_F(TestReportManager, DISABLED_failToAddReportWhenMaxReportIsReached)
{
reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))