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

Add actions to control the new workload #54

Closed
wants to merge 17 commits into from
Closed

Conversation

nrobinaubertin
Copy link
Collaborator

@nrobinaubertin nrobinaubertin commented Oct 9, 2024

Overview

Checklist

@nrobinaubertin nrobinaubertin marked this pull request as ready for review October 10, 2024 10:03
@nrobinaubertin nrobinaubertin requested a review from a team as a code owner October 10, 2024 10:03
src/bind.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
config.yaml Show resolved Hide resolved
@amandahla
Copy link

Nice PR!

Some points:

  • I missed unit tests and failure tests
  • For this one or a further PR: documentation on how to use charmed-bind-snap

@nrobinaubertin
Copy link
Collaborator Author

* I missed unit tests and failure tests

There's not a a lot of added logic in the charm for now, everything is mostly handled by the snap who has its own tests.
New tests will come when actually using these ACLs in the next PR

* For this one or a further PR: documentation on how to use charmed-bind-snap

This will be done in the next cycle for sure

amandahla
amandahla previously approved these changes Oct 15, 2024
Copy link

@amandahla amandahla left a comment

Choose a reason for hiding this comment

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

LGTM

amandahla
amandahla previously approved these changes Oct 22, 2024
Copy link

@javierdelapuente javierdelapuente left a comment

Choose a reason for hiding this comment

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

A few comments

@@ -31,7 +33,7 @@ class PeerRelationNetworkUnavailableError(exceptions.BindCharmError):
"""Exception raised when the peer relation network is unavailable."""


class BindCharm(ops.CharmBase):
class BindCharm(actions_mixin.ActionsMixin, ops.CharmBase):

Choose a reason for hiding this comment

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

I am not sure about the use of multiple inheritance here using a mixin, as it is not going to be reused in other places.

As ActionsMixin only uses three variables (charm.on, charm.bind and charm.framework) I think an instance of tha class could be created with those variables explicitly passed, and so BindCharm and ActionsMixin are a bit less coupled.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IMO, if we pass and instance of the class, they are tightly coupled. I'm doing the mixin dance to acknowledge it but still split the code in two.
This is in contrast to the bind service who can be tested outside of the charm instance.

src/bind.py Outdated Show resolved Hide resolved
self.snap_path: str = ""
try:
self.snap_path = str(self.model.resources.fetch("charmed-bind-snap"))
except ops.ModelError as e:

Choose a reason for hiding this comment

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

Will this work without charmed-bind-snap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the CI is working without it. I'm just using it locally

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, my bad. Doesn't work in the last CI anymore. Fixing...

tests/integration/helpers.py Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
Copy link
Contributor

Test coverage for 75c5864

Name                               Stmts   Miss Branch BrPart  Cover   Missing
------------------------------------------------------------------------------
lib/charms/bind/v0/dns_record.py     231     10     22      0    96%   324-329, 637-644
src/actions_mixin.py                  19     19      0      0     0%   9-92
src/bind.py                          140    140     32      0     0%   6-392
src/charm.py                         168    168     36      0     0%   7-337
src/constants.py                      14     14      0      0     0%   6-71
src/dns_data.py                       72     14     38      0    80%   38-51
src/events.py                          2      2      0      0     0%   7-10
src/exceptions.py                      3      3      0      0     0%   7-16
src/models.py                         33      5      4      0    81%   60-66, 111
------------------------------------------------------------------------------
TOTAL                                682    375    132      0    44%

Static code analysis report

Run started:2024-10-25 14:19:19.384032

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 2722
  Total lines skipped (#nosec): 9
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@nrobinaubertin
Copy link
Collaborator Author

Closing this as ACLs will be part of a DNS policy charm

@nrobinaubertin nrobinaubertin mentioned this pull request Nov 6, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants