Skip to content

Conversation

tonyandrewmeyer
Copy link
Contributor

With Juju secrets only the leader unit has admin access to app secrets, and ops 2.9 and above enforce this in Harness to match the Juju behaviour.

One test (test_migration_from_single_secret) currently does a set_secret call (via the charm's `set_secret method) when acting as a non-leader unit. This would not work in production, and fails in ops 2.9.

The PR simply calls set_leader() appropriately around the set_secret call, so that the rest of the test (in all three parameterised versions) remain unchanged.

@tonyandrewmeyer tonyandrewmeyer changed the title Setting app secrets can only be done by the leader - ops 2.9+ enforce… fix: secret tests must only set app secrets as the leader Jan 15, 2024
@tonyandrewmeyer
Copy link
Contributor Author

The test failures don't seem like they should be related to this change (which is only in one - parametrised - unit test), but if they are, let me know and I can work on addressing whatever happened.

Copy link
Contributor

@dragomirp dragomirp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution.

Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@marceloneppel marceloneppel merged commit 95f60ad into canonical:main Jan 16, 2024
@tonyandrewmeyer tonyandrewmeyer deleted the fix-secret-set-test branch January 16, 2024 20:07
BON4 pushed a commit to BON4/postgresql-operator that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants