refactor(agent-charm): move methods to charm utilities#935
Open
rene-oromtz wants to merge 2 commits intomainfrom
Open
refactor(agent-charm): move methods to charm utilities#935rene-oromtz wants to merge 2 commits intomainfrom
rene-oromtz wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #935 +/- ##
=======================================
Coverage 73.85% 73.85%
=======================================
Files 108 108
Lines 10313 10313
Branches 886 886
=======================================
Hits 7617 7617
Misses 2508 2508
Partials 188 188
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
ajzobro
reviewed
Feb 26, 2026
Contributor
ajzobro
left a comment
There was a problem hiding this comment.
Looks good, my few comments are mostly comment verbiage.
agent/charms/testflinger-agent-host-charm/tests/unit/test_charm_utils.py
Outdated
Show resolved
Hide resolved
agent/charms/testflinger-agent-host-charm/tests/unit/test_charm_utils.py
Outdated
Show resolved
Hide resolved
agent/charms/testflinger-agent-host-charm/tests/unit/test_charm_utils.py
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@ajzobro Thanks for the feedback, I added the suggested modifications, in case anything else is needed please let me know! |
ajzobro
approved these changes
Mar 4, 2026
Contributor
ajzobro
left a comment
There was a problem hiding this comment.
Looks good, thanks for considering my changes!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
While trying to add charm code to the coverage report, noticed that it was very low on charm code side so before including coverage though on bumping up a little:
Current unreported coverage:
Trying to keep it simpler for easier review so this PR moves some methods that can belong to a new module called "charm_utils", this covers all operation that belong to the charm lifecycle but that are not necessarily needed on charm code.
Also added a pydantic additional validation, instead of manually comparing
config_dirandconfig_repoon each Charm Hook, I'm lettingload_config()block the charm unit.With the moved logic, coverage improved ~7%:
A follow up PR will add this coverage report
Resolved issues
N/A
Documentation
Web service API changes
Tests
Modify current tests to catch
UncaughtCharmErrortriggered by Pydantic validation.Also added unit tests for 100% coverage in
charm_utils.py