Skip to content

Conversation

arjun11-malik
Copy link

@arjun11-malik arjun11-malik commented Aug 4, 2025

Issue

Fixes Issue #649

Solution

Replaced the improper usage of event.set_results(success=False) with event.fail("...").
Also added a unit test for get-cluster-status action to cover both success and failure scenarios.

Checklist

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

Copy link

codecov bot commented Aug 4, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.37%. Comparing base (e7c1809) to head (7fe7885).
⚠️ Report is 180 commits behind head on main.

Files with missing lines Patch % Lines
lib/charms/mysql/v0/mysql.py 75.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #663      +/-   ##
==========================================
- Coverage   66.25%   63.37%   -2.88%     
==========================================
  Files          17       20       +3     
  Lines        3180     4623    +1443     
  Branches      424      759     +335     
==========================================
+ Hits         2107     2930     +823     
- Misses        935     1445     +510     
- Partials      138      248     +110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arjun11-malik arjun11-malik changed the title Fix: replace event.set_results(success=False) with event.fail() in get-cluster-status Bug: replace event.set_results(success=False) with event.fail() in get-cluster-status Aug 4, 2025
@arjun11-malik arjun11-malik changed the title Bug: replace event.set_results(success=False) with event.fail() in get-cluster-status bug : replace event.set_results(success=False) with event.fail() in get-cluster-status Aug 4, 2025
@paulomach paulomach added the bug Something isn't working as expected label Aug 4, 2025
status = self._mysql.get_cluster_status()

if not status:
event.fail("Failed to read cluster status. See logs for more information.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arjun11-malik make sure that the output change is not being misinterpreted on the the failing tests

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve double-checked every integration test that invokes get-cluster-status—they only wait for the action to complete and then read out results["status"]. None of them inspect the old success=False payload or rely on its exact shape, so switching to event.fail() on empty status won’t change their behavior.

@arjun11-malik arjun11-malik force-pushed the bugfix/get-cluster-status-fail branch from 95ea517 to 327a441 Compare August 8, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants