Skip to content

Commit

Permalink
Update charm libraries (#257)
Browse files Browse the repository at this point in the history
* chore: update charm libraries

* Fix unit tests

* fix linting

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: arturo-seijas <[email protected]>
Co-authored-by: Arturo Seijas <[email protected]>
  • Loading branch information
3 people committed Jun 7, 2024
1 parent 7590dc0 commit 92ce076
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/charms/rolling_ops/v0/rollingops.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _on_trigger_restart(self, event):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 6
LIBPATCH = 7


class LockNoRelationError(Exception):
Expand Down Expand Up @@ -318,6 +318,7 @@ def __init__(self, charm: CharmBase, relation: AnyStr, callback: Callable):
self.framework.observe(charm.on[self.name].acquire_lock, self._on_acquire_lock)
self.framework.observe(charm.on[self.name].run_with_lock, self._on_run_with_lock)
self.framework.observe(charm.on[self.name].process_locks, self._on_process_locks)
self.framework.observe(charm.on.leader_elected, self._on_process_locks)

def _callback(self: CharmBase, event: EventBase) -> None:
"""Placeholder for the function that actually runs our event.
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ def exec_handler(args: ops.testing.ExecArgs) -> None:
for call in exec_calls:
harness.handle_exec(SERVICE_NAME, call, handler=exec_handler)

# The leader-elected event will cause rollingops to fail because the RollingOpsManager has not
# yet been initialised in the charm's __init__ method.
harness.disable_hooks()
harness.set_leader(True)
harness.enable_hooks()
harness.container_pebble_ready(SERVICE_NAME)
# A few events are not emitted, like config_changed.
harness.charm.on.start.emit()
Expand Down

0 comments on commit 92ce076

Please sign in to comment.