-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add CI tests against postgresql and mysql #602
Comments
Hey, that's a great idea! IHM uses TravisCI, and it has support for PostgreSQL and MySQL (and actually quite a few others). Then I'm not sure about the best way to do it, but here are a few ideas :
|
@indatwood thanks for the pointers! I skimmed the doc a bit, and it seems that using env variables is the way to go. I'm testing this now on #631 |
Fun realisation: we may need a test to check that CI tests are actually run against postgresql ^^ |
Ok, this is the way I got it to work in #631 :
I think we don't need more tox test environments, because postgresql and mysql require configuration so they can't be run by default. It seems simpler to keep the current tox test environments, and simply allow to choose between sqlite/postgresql/mysql with an environment variable. This is open to discussion though (related to the "dependencies" point below). Database-specific dependenciesWith the current setup, we need to install This is not such a big issue because we can use Same for mysql: despite what IHM's doc says, I'm still interested to hear if it's OK to install both in the dev environment. Checking that tests are actually run with postgresql/mysqlThis part is difficult. Given the complex chain of information from travis down to the actual tests, it's very likely that somebody will silently break the postgresql/mysql testing setup one day. Tests will appear to pass on Travis, but they would actually run with the default sqlite instead of postgresql or mysql. For now I don't have a good idea on how to handle this. |
I am wondering if it's possible to make them optional, but requires them to run tox tests. Or make tox issue a warning when such a requirement is missing. |
I thought about it, but I didn't find anything in tox to do something like that (conditionally install a package depending on the value of an environment variable) It would be easy to install dependencies in new tox test environments like |
You probably can test if the Travis env variable is set (or another one like RUN_POSTGRES_TESTS) in the tests and run it only if it is the case. And then set the variable in the Travis config :-) |
This was finally done in #631 |
Two recent examples (#601 and #577) show that sqlite behaves very differently from postgresql and mysql, and that they both get much less exposure than sqlite. This results in bugs or regressions that are discovered late.
We cannot reasonably expect contributors to test their code with sqlite, postgresql, mysql. Before upgrading to a major ihatemoney release in production, I manually check that it works with postgresql, but it's tedious.
This sounds like a job for the CI! It should run all tests against sqlite, postgresql and mysql.
I have no idea about how the CI works and if this is easy to do or not: any idea?
The text was updated successfully, but these errors were encountered: