-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Make sure multi-db tests are passing #2813
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests assume that all DBs will be in the settings dict, and that we'll be able to modify the settings dict at runtime.
You can't modify the settings dict at runtime and expect things to work. They were flaky because of that (there's some kind of thread-dependence issue), and so I disabled them. I don't think they should be reenabled. The reason I didn't delete them outright was that I assume we'll want to make valid versions of these at some point.
https://docs.djangoproject.com/en/4.2/topics/settings/#altering-settings-at-runtime
NOTE: It's possible the thread-dependence thing goes away since we're no longer running tests in parallel, but I still don't think it's a good idea to use these tests.
@mathemancer Do you have ideas about how to fix this? I can only think of redoing how we define user databases (which would be nice; should make an issue for that), but I'm not sure we have time for that right now. I think it's important to test multi-db support, since we'll now have user-facing functionality dependent on that. Do you agree? If we don't know how to fix this without making a project out of it, and the problem is only that these tests may have random false failures, maybe let's enable them and see what happens? If false failures do happen, and they mess with our workflow, we can then use that as justification to invest more time into this. |
@dmos62 I agree that now is not the time for modifying how we define DBs (though I also agree that we should fix that ASAP). Couldn't we come up with a way to make the tests accurate to our current setup? I.e., we're not supporting modifying the settings dict at runtime (in memory) anyway, so why should we test that? Wouldn't it be possible to just use a different settings file during testing, or even set up separate tests for this that use a multi-db settings file? What happens if they actually have multiple DBs defined in their settings file? I'm not actually sure what will happen to our tests, or these tests in that case. |
@mathemancer we've been setting up and tearing down the Django Are you sure that fixing this now is warranted? Setting up a separate testing suite with its own Django configuration sounds like overkill (that's what would be required, if I'm not mistaken). I've tested running Django with multiple user dbs hardcoded in the config and it worked fine, for what it's worth. |
Django docs for overriding settings in tests: https://docs.djangoproject.com/en/4.2/topics/testing/tools/#overriding-settings, just in case it helps. |
I think turning these tests back off would be far preferable to setting a trap in our testing suite to forget about. We'd inevitably end up building more on top of the same misguided setup, making the problem worse and worse.
Unless I'm misunderstanding, that page indicates that using those methods on |
We have an issue to track this, and when we refactor how we define user dbs, all of this will have to be changed, so these few tests, and whatever tests we derive from them, aren't something we can forget, unless we forget to fix user db definition. As for it being a trap, I'm still not sure what the problem is here, but you mention it being about multi-threading, so how about we restrict these tests to running in the same Or, better yet, since we don't use xdist at the moment, how about we create an issue for reenabling To be clear for why I'm inclined not to simply disable the tests, I'll repeat that I think it's important to test multi-db support, since we'll now have user-facing functionality dependent on that. |
Why are we refactoring how we define user DBs? |
Me and @mathemancer resolved this in sync:
|
@dmos62 I looked at #2816 but there's not enough context there. I don't understand the underlyng problem, and so I can't evaluate whether redoing the way we define user DBs the only/best solution to it. It might be better to keep the GitHub issue focused on explaining the problem rather than presuming the solution. |
Related #2007
Some maintenance on multi-db tests, in preparation for db-switching functionality on frontend. Biggest change is reenabling tests that were marked for skipping for some reason.
Also did basic smoke checking locally.
Checklist
Update index.md
).develop
branch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin