Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmd] Warning message on no run delete. #3915

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ service codeCheckerDBAccess {
3: CompareData cmpData)
throws (1: codechecker_api_shared.RequestFailed requestError),

// Remove run from the database.
// Remove run from the database. Return true if at least one report removed with the given criteria.
// PERMISSION: PRODUCT_STORE
bool removeRun(1: i64 runId,
2: optional RunFilter runFilter)
Expand Down
4 changes: 3 additions & 1 deletion web/client/codechecker_client/cmd_line_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,9 @@ def handle_remove_run_results(args):
if client.removeRun(None, run_filter):
LOG.info("Done.")
else:
LOG.error("Failed to remove runs!")
LOG.warning(
"No runs were removed, check if the given criteria match existing "
"run names.")


def handle_update_run(args):
Expand Down
2 changes: 1 addition & 1 deletion web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3387,7 +3387,7 @@ def removeRun(self, run_id, run_filter):
db_cleanup.remove_unused_comments(self._Session)
db_cleanup.remove_unused_analysis_info(self._Session)

return True
return bool(runs)

@exc_to_thrift_reqfail
@timeit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ def test_remove_run_results(self):
# Check that we removed all results from the run.
res = self._cc_client.getRunResultCount([run_id], ReportFilter(), None)
self.assertEqual(res, 0)

def test_remove_nonexisting_run(self):
"""
Test if False is returned on the removal of a non-existing run's
removal.
"""
run_filter = RunFilter(names=['non_existing'], exactMatch=True)
res = self._cc_client.removeRun(None, run_filter)
self.assertFalse(res)