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

Harness test fails in v.2.10.0: relation is None during removal hook #1119

Closed
sed-i opened this issue Feb 1, 2024 · 1 comment
Closed

Harness test fails in v.2.10.0: relation is None during removal hook #1119

sed-i opened this issue Feb 1, 2024 · 1 comment

Comments

@sed-i
Copy link
Contributor

sed-i commented Feb 1, 2024

  File "/home/ubuntu/code/o11y/traefik-k8s-operator/tests/unit/test_lib_per_unit_requires.py", line 193, in test_ipu_events
    self.harness.remove_relation(self.rel_id)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/testing.py", line 892, in remove_relation
    self._emit_relation_broken(relation_name, relation_id, remote_app)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/testing.py", line 926, in _emit_relation_broken
    self._charm.on[relation_name].relation_broken.emit(relation, app)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 351, in emit
    framework._emit(event)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 853, in _emit
    self._reemit(event_path)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 943, in _reemit
    custom_handler(event)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/lib/charms/traefik_k8s/v1/ingress_per_unit.py", line 753, in _handle_relation
    self.on.revoked_for_unit.emit(self.relation)  # type: ignore
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 351, in emit
    framework._emit(event)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 848, in _emit
    self.save_snapshot(event)
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/framework.py", line 717, in save_snapshot
    data = value.snapshot()
  File "/home/ubuntu/code/o11y/traefik-k8s-operator/.tox/unit/lib/python3.10/site-packages/ops/charm.py", line 434, in snapshot
    'relation_name': self.relation.name,
AttributeError: 'NoneType' object has no attribute 'name'

Pinning ops < 2.10.0 has the test pass as before.

@sed-i sed-i changed the title Harness test fail in v.2.10.0: relation.name is None during removal hook Harness test fails in v.2.10.0: relation.name is None during removal hook Feb 1, 2024
@sed-i sed-i changed the title Harness test fails in v.2.10.0: relation.name is None during removal hook Harness test fails in v.2.10.0: relation is None during removal hook Feb 1, 2024
@sed-i
Copy link
Contributor Author

sed-i commented Feb 1, 2024

Ok I see now that it's after relation broken, so this behavior is desirable and added in #1091.
Closing.

@sed-i sed-i closed this as completed Feb 1, 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

No branches or pull requests

1 participant