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

[enhancement proposal] Refactor Harness to reinitialize and discard Charm on every event dispatch. #789

Closed
PietroPasotti opened this issue Jun 27, 2022 · 2 comments

Comments

@PietroPasotti
Copy link
Contributor

I think it might be worth it to refactor the harness to work more like ops-in-production does.
Namely: not just initialize the charm, do things and fire events on this one instance, but rather: only initialize the charm on every event dispatch, then discard it.
This would be helpful to catch beginner mistakes such as attempting to store state into the charm object.
Also it will remove the need for workarounds like #758 and allow for easier unittesting of code containing __init__ logic (without forcing the user to remember to reinitialize_charm() for example.

@rwcarlsen
Copy link
Contributor

This seems like a duplicate of #736.

@PietroPasotti
Copy link
Contributor Author

Funny, apparently I am very keen on this but not keen enough to remember I raised the issue already. :/

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

2 participants