While evaluating the upgrade to ops 3.8.0, one of my charm unit tests started failing.
The test is a charm revoking a secret grant when a relation goes away.
The same test passes on ops 3.7.1 and fails on ops 3.8.0
(which pulls in ops-scenario 8.8.0 via the testing extra).
I've asked Claude to reduce it to the minimal self-contained reproduction below.
Let me know what you think.
This is the output I get AttributeError: 'frozenset' object has no attribute 'remove'
# repro_revoke.py
import ops
from ops import testing
class RevokeCharm(ops.CharmBase):
def __init__(self, framework):
super().__init__(framework)
framework.observe(self.on["db"].relation_broken, self._on_broken)
def _on_broken(self, event):
# Revoke the secret's grant to the relation that is going away.
secret = self.model.get_secret(label="my-secret")
secret.revoke(event.relation)
def test_revoke_on_relation_broken():
ctx = testing.Context(
RevokeCharm,
meta={"name": "revoke-charm", "provides": {"db": {"interface": "x"}}},
)
secret = testing.Secret(
{"token": "s3cret"},
owner="app",
label="my-secret",
remote_grants={1: {"remote-app"}}, # relation 1 was previously granted
)
While evaluating the upgrade to ops 3.8.0, one of my charm unit tests started failing.
The test is a charm revoking a secret grant when a relation goes away.
The same test passes on ops 3.7.1 and fails on ops 3.8.0
(which pulls in ops-scenario 8.8.0 via the testing extra).
I've asked Claude to reduce it to the minimal self-contained reproduction below.
Let me know what you think.
This is the output I get
AttributeError: 'frozenset' object has no attribute 'remove'