-
Notifications
You must be signed in to change notification settings - Fork 192
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
Prevent tests from deleting the default user #2480
Prevent tests from deleting the default user #2480
Conversation
PR aiidateam#2214 stripped of safeguards that prevented the default user from being deleted in between tests. Since AiiDA expects a default user in many operations, leaving the DB in a state with no default user is not ideal. This commit reintroduces safeguards that result in the default user remaining untouched.
I've approved, but actually a few tests fail. |
This did not resolve the issue observed in #2400. |
Just a small comment on this: I just wanted to say that since we decided to expect a clean database at the beginning of each test class and leave a clean database at the end of each test class, we should ensure that this happens in both backends. Maybe what I say it is obvious and it is already done, but I wanted to mention it. |
I would tend to agree that we should be able to delete all resources, including default users for tests databases, and if they are needed for certain operations it should be recreated. The problem you experienced during #2400 has another root cause I think, where as you said, certain classes in AiiDA can retain references to ORM instances that point to database model instances that have been cleaned, leading to problems mostly in SqlAlchemy. You already opened an issue in #2515 to address a (part) of this question, so I suggest we try to solve the greater problem instead. |
Fix #2407
PR #2214 (inadvertently?) removed safeguards that prevented the default user from
being deleted in between tests.
Since AiiDA expects a default user in many operations, leaving the DB
in a state with no default user is not ideal.
This PR reintroduces safeguards that result in the default user
remaining untouched.