This is an automated email from the ASF dual-hosted git repository. szaszm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit e63a287fe5ac4b0c55491af743f9148cca0dd06d Author: Gabor Gyimesi <[email protected]> AuthorDate: Tue Feb 14 16:34:10 2023 +0100 MINIFICPP-1997 Fix transiently failing FileSystemRepositoryTests Closes #1507 Signed-off-by: Marton Szasz <[email protected]> --- libminifi/test/unit/FileSystemRepositoryTests.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libminifi/test/unit/FileSystemRepositoryTests.cpp b/libminifi/test/unit/FileSystemRepositoryTests.cpp index 06a0195ce..b49fe60c5 100644 --- a/libminifi/test/unit/FileSystemRepositoryTests.cpp +++ b/libminifi/test/unit/FileSystemRepositoryTests.cpp @@ -28,6 +28,9 @@ #include "../Catch.h" #include "utils/Literals.h" #include "core/repository/FileSystemRepository.h" +#include "utils/IntegrationTestUtils.h" + +using namespace std::literals::chrono_literals; TEST_CASE("Test Physical memory usage", "[testphysicalmemoryusage]") { TestController controller; @@ -37,6 +40,7 @@ TEST_CASE("Test Physical memory usage", "[testphysicalmemoryusage]") { config->set(minifi::Configure::nifi_dbcontent_repository_directory_default, dir.string()); REQUIRE(fs_repo->initialize(config)); const auto start_memory = utils::OsUtils::getCurrentProcessPhysicalMemoryUsage(); + REQUIRE(start_memory > 0); auto content_session = fs_repo->createSession(); auto resource_id = content_session->create(); @@ -47,7 +51,10 @@ 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; + CHECK(verifyEventHappenedInPollTime(5s, [&] { + const auto end_memory = utils::OsUtils::getCurrentProcessPhysicalMemoryUsage(); + REQUIRE(end_memory > 0); + return end_memory < start_memory + int64_t{5_MB}; + }, 100ms)); }
