From 86581ec002094c1e5ccbe57bfc60e8273f3e750a Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 8 Apr 2023 18:50:39 +0200 Subject: [PATCH] Add note in cleanup action stating how many build actions have been deleted --- librepomgr/buildactions/buildaction.cpp | 1 + librepomgr/tests/buildactions.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/librepomgr/buildactions/buildaction.cpp b/librepomgr/buildactions/buildaction.cpp index ec3a192..0410b89 100644 --- a/librepomgr/buildactions/buildaction.cpp +++ b/librepomgr/buildactions/buildaction.cpp @@ -520,6 +520,7 @@ void BuildServiceCleanup::run() return --count <= stopAt; }, &count); + m_messages.notes.emplace_back(argsToString("deleted ", count, " build actions")); auto lock = lockToWrite(); m_dbCleanupConcluded = true; conclude(std::move(lock)); diff --git a/librepomgr/tests/buildactions.cpp b/librepomgr/tests/buildactions.cpp index 3815ff3..6a3a0e4 100644 --- a/librepomgr/tests/buildactions.cpp +++ b/librepomgr/tests/buildactions.cpp @@ -950,7 +950,8 @@ void BuildActionsTests::testBuildServiceCleanup() CPPUNIT_ASSERT_EQUAL_MESSAGE("failure", BuildActionResult::Failure, m_buildAction->result); const auto &messages = std::get(m_buildAction->resultData); CPPUNIT_ASSERT_EQUAL_MESSAGE("one error", 1_st, messages.errors.size()); - TESTUTILS_ASSERT_LIKE("expected error", "unable to locate package cache directories:.*No such file or directory.*", messages.errors.front()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("one note", 1_st, messages.notes.size()); CPPUNIT_ASSERT_EQUAL_MESSAGE("no warnings", std::vector(), messages.warnings); - CPPUNIT_ASSERT_EQUAL_MESSAGE("no notes", std::vector(), messages.notes); + TESTUTILS_ASSERT_LIKE("expected error", "unable to locate package cache directories:.*No such file or directory.*", messages.errors.front()); + TESTUTILS_ASSERT_LIKE("expected note", "deleted 1 build actions", messages.notes.front()); }