fgerlits commented on code in PR #1507:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1507#discussion_r1104243506
##########
libminifi/test/unit/FileSystemRepositoryTests.cpp:
##########
@@ -47,7 +50,6 @@ TEST_CASE("Test Physical memory usage",
"[testphysicalmemoryusage]") {
stream->write(fragment.as_span<const std::byte>());
}
- const auto end_memory =
utils::OsUtils::getCurrentProcessPhysicalMemoryUsage();
-
- REQUIRE(gsl::narrow<size_t>(end_memory - start_memory) < 1_MB);
+ using org::apache::nifi::minifi::utils::verifyEventHappenedInPollTime;
+ REQUIRE(verifyEventHappenedInPollTime(5s, [&] { return
gsl::narrow<size_t>(utils::OsUtils::getCurrentProcessPhysicalMemoryUsage() -
start_memory) < 5_MB; }, 100ms));
Review Comment:
It's not likely to happen, but I don't think we want to terminate if the
current memory usage is lower than `start_memory`.
```suggestion
CHECK(verifyEventHappenedInPollTime(5s, [&] {
const auto end_memory =
utils::OsUtils::getCurrentProcessPhysicalMemoryUsage();
REQUIRE(end_memory > 0);
return end_memory < start_memory + gsl::narrow<int64_t>(5_MB);
}, 100ms));
```
I would also put a `REQUIRE(start_memory > 0)` after line 42.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]