Skip to content

Commit

Permalink
Setting app secrets can only be done by the leader - ops 2.9+ enforce…
Browse files Browse the repository at this point in the history
…s this like Juju. (#322)
  • Loading branch information
tonyandrewmeyer authored Jan 16, 2024
1 parent ac3a314 commit 95f60ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,12 @@ def test_migration_from_single_secret(self, scope, is_leader, _, __):
assert self.harness.charm.get_secret(scope, "operator-password") == "bla"

# Reset new secret
# Only the leader can set app secret content.
with self.harness.hooks_disabled():
self.harness.set_leader(True)
self.harness.charm.set_secret(scope, "operator-password", "blablabla")
with self.harness.hooks_disabled():
self.harness.set_leader(is_leader)
assert self.harness.charm.model.get_secret(label=f"postgresql.{scope}")
assert self.harness.charm.get_secret(scope, "operator-password") == "blablabla"
assert SECRET_INTERNAL_LABEL not in self.harness.get_relation_data(
Expand Down

0 comments on commit 95f60ad

Please sign in to comment.